home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb-4.5 / dist / gdb / c-exp.tab.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-11  |  71.2 KB  |  2,436 lines

  1.  
  2. /*  A Bison parser, made from ./c-exp.y  */
  3.  
  4. #define    INT    258
  5. #define    CHAR    259
  6. #define    UINT    260
  7. #define    FLOAT    261
  8. #define    STRING    262
  9. #define    NAME    263
  10. #define    TYPENAME    264
  11. #define    NAME_OR_INT    265
  12. #define    NAME_OR_UINT    266
  13. #define    STRUCT    267
  14. #define    UNION    268
  15. #define    ENUM    269
  16. #define    SIZEOF    270
  17. #define    UNSIGNED    271
  18. #define    COLONCOLON    272
  19. #define    TEMPLATE    273
  20. #define    ERROR    274
  21. #define    SIGNED_KEYWORD    275
  22. #define    LONG    276
  23. #define    SHORT    277
  24. #define    INT_KEYWORD    278
  25. #define    LAST    279
  26. #define    REGNAME    280
  27. #define    VARIABLE    281
  28. #define    ASSIGN_MODIFY    282
  29. #define    THIS    283
  30. #define    ABOVE_COMMA    284
  31. #define    OROR    285
  32. #define    ANDAND    286
  33. #define    EQUAL    287
  34. #define    NOTEQUAL    288
  35. #define    LEQ    289
  36. #define    GEQ    290
  37. #define    LSH    291
  38. #define    RSH    292
  39. #define    UNARY    293
  40. #define    INCREMENT    294
  41. #define    DECREMENT    295
  42. #define    ARROW    296
  43. #define    BLOCKNAME    297
  44.  
  45. #line 29 "./c-exp.y"
  46.  
  47.  
  48. #include <stdio.h>
  49. #include <string.h>
  50. #include "defs.h"
  51. #include "symtab.h"
  52. #include "gdbtypes.h"
  53. #include "frame.h"
  54. #include "expression.h"
  55. #include "parser-defs.h"
  56. #include "value.h"
  57. #include "language.h"
  58. #include "bfd.h"
  59. #include "symfile.h"
  60. #include "objfiles.h"
  61.  
  62. /* Ensure that if the generated parser contains any calls to malloc/realloc,
  63.    that they get mapped to xmalloc/xrealloc. */
  64.  
  65. #define malloc    xmalloc
  66. #define realloc    xrealloc
  67.  
  68. /* These MUST be included in any grammar file!!!! 
  69.    Please choose unique names! */
  70. #define    yymaxdepth c_maxdepth
  71. #define    yyparse    c_parse
  72. #define    yylex    c_lex
  73. #define    yyerror    c_error
  74. #define    yylval    c_lval
  75. #define    yychar    c_char
  76. #define    yydebug    c_debug
  77. #define    yypact    c_pact    
  78. #define    yyr1    c_r1            
  79. #define    yyr2    c_r2            
  80. #define    yydef    c_def        
  81. #define    yychk    c_chk        
  82. #define    yypgo    c_pgo        
  83. #define    yyact    c_act        
  84. #define    yyexca    c_exca
  85. #define yyerrflag c_errflag
  86. #define yynerrs    c_nerrs
  87. #define    yyps    c_ps
  88. #define    yypv    c_pv
  89. #define    yys    c_s
  90. #define    yy_yys    c_yys
  91. #define    yystate    c_state
  92. #define    yytmp    c_tmp
  93. #define    yyv    c_v
  94. #define    yy_yyv    c_yyv
  95. #define    yyval    c_val
  96. #define    yylloc    c_lloc
  97.  
  98. int
  99. yyparse PARAMS ((void));
  100.  
  101. int
  102. yylex PARAMS ((void));
  103.  
  104. void
  105. yyerror PARAMS ((char *));
  106.  
  107. /* #define    YYDEBUG    1 */
  108.  
  109.  
  110. #line 98 "./c-exp.y"
  111. typedef union
  112.   {
  113.     LONGEST lval;
  114.     unsigned LONGEST ulval;
  115.     double dval;
  116.     struct symbol *sym;
  117.     struct type *tval;
  118.     struct stoken sval;
  119.     struct ttype tsym;
  120.     struct symtoken ssym;
  121.     int voidval;
  122.     struct block *bval;
  123.     enum exp_opcode opcode;
  124.     struct internalvar *ivar;
  125.  
  126.     struct type **tvec;
  127.     int *ivec;
  128.   } YYSTYPE;
  129. #line 117 "./c-exp.y"
  130.  
  131. /* YYSTYPE gets defined by %union */
  132. static int
  133. parse_number PARAMS ((char *, int, int, YYSTYPE *));
  134.  
  135. #ifndef YYLTYPE
  136. typedef
  137.   struct yyltype
  138.     {
  139.       int timestamp;
  140.       int first_line;
  141.       int first_column;
  142.       int last_line;
  143.       int last_column;
  144.       char *text;
  145.    }
  146.   yyltype;
  147.  
  148. #define YYLTYPE yyltype
  149. #endif
  150.  
  151. #include <stdio.h>
  152.  
  153. #ifndef __STDC__
  154. #define const
  155. #endif
  156.  
  157.  
  158.  
  159. #define    YYFINAL        210
  160. #define    YYFLAG        -32768
  161. #define    YYNTBASE    67
  162.  
  163. #define YYTRANSLATE(x) ((unsigned)(x) <= 297 ? yytranslate[x] : 87)
  164.  
  165. static const char yytranslate[] = {     0,
  166.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  167.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  168.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  169.      2,     2,    60,     2,     2,     2,    51,    37,     2,    58,
  170.     63,    49,    47,    29,    48,    56,    50,     2,     2,     2,
  171.      2,     2,     2,     2,     2,     2,     2,    66,     2,    40,
  172.     31,    41,    32,    46,     2,     2,     2,     2,     2,     2,
  173.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  174.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  175.     57,     2,    62,    36,     2,     2,     2,     2,     2,     2,
  176.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  177.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  178.      2,     2,    64,    35,    65,    61,     2,     2,     2,     2,
  179.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  180.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  181.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  182.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  183.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  184.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  185.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  186.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  187.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  188.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  189.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  190.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  191.      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
  192.      6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
  193.     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
  194.     26,    27,    28,    30,    33,    34,    38,    39,    42,    43,
  195.     44,    45,    52,    53,    54,    55,    59
  196. };
  197.  
  198. static const short yyrline[] = {     0,
  199.    199,   200,   203,   210,   211,   216,   219,   222,   226,   230,
  200.    234,   238,   242,   246,   250,   254,   260,   267,   271,   277,
  201.    285,   289,   293,   297,   303,   306,   310,   314,   320,   326,
  202.    332,   336,   340,   344,   348,   352,   356,   360,   364,   368,
  203.    372,   376,   380,   384,   388,   392,   396,   400,   404,   408,
  204.    412,   416,   422,   432,   445,   457,   470,   477,   484,   487,
  205.    493,   499,   505,   512,   519,   526,   544,   554,   567,   580,
  206.    605,   606,   648,   735,   736,   771,   773,   775,   777,   779,
  207.    782,   784,   789,   795,   797,   801,   803,   807,   809,   813,
  208.    814,   816,   818,   821,   828,   830,   832,   834,   836,   838,
  209.    840,   842,   844,   846,   848,   850,   852,   855,   858,   861,
  210.    863,   865,   867,   869,   875,   876,   882,   888,   897,   902,
  211.    909,   910,   911,   912,   913,   916,   917
  212. };
  213.  
  214. static const char * const yytname[] = {     0,
  215. "error","$illegal.","INT","CHAR","UINT","FLOAT","STRING","NAME","TYPENAME","NAME_OR_INT",
  216. "NAME_OR_UINT","STRUCT","UNION","ENUM","SIZEOF","UNSIGNED","COLONCOLON","TEMPLATE","ERROR","SIGNED_KEYWORD",
  217. "LONG","SHORT","INT_KEYWORD","LAST","REGNAME","VARIABLE","ASSIGN_MODIFY","THIS","','","ABOVE_COMMA",
  218. "'='","'?'","OROR","ANDAND","'|'","'^'","'&'","EQUAL","NOTEQUAL","'<'",
  219. "'>'","LEQ","GEQ","LSH","RSH","'@'","'+'","'-'","'*'","'/'",
  220. "'%'","UNARY","INCREMENT","DECREMENT","ARROW","'.'","'['","'('","BLOCKNAME","'!'",
  221. "'~'","']'","')'","'{'","'}'","':'","start"
  222. };
  223.  
  224. static const short yyr1[] = {     0,
  225.     67,    67,    68,    69,    69,    70,    70,    70,    70,    70,
  226.     70,    70,    70,    70,    70,    70,    70,    70,    70,    70,
  227.     70,    70,    71,    70,    72,    72,    72,    70,    70,    70,
  228.     70,    70,    70,    70,    70,    70,    70,    70,    70,    70,
  229.     70,    70,    70,    70,    70,    70,    70,    70,    70,    70,
  230.     70,    70,    70,    70,    70,    70,    70,    70,    70,    70,
  231.     70,    70,    70,    70,    70,    73,    73,    74,    75,    75,
  232.     74,    74,    74,    76,    76,    77,    77,    77,    77,    77,
  233.     78,    78,    78,    78,    78,    79,    79,    80,    80,    81,
  234.     81,    81,    81,    81,    82,    82,    82,    82,    82,    82,
  235.     82,    82,    82,    82,    82,    82,    82,    82,    82,    82,
  236.     82,    82,    82,    82,    83,    83,    83,    83,    84,    84,
  237.     85,    85,    85,    85,    85,    86,    86
  238. };
  239.  
  240. static const short yyr2[] = {     0,
  241.      1,     1,     1,     1,     3,     2,     2,     2,     2,     2,
  242.      2,     2,     2,     2,     2,     3,     3,     4,     3,     3,
  243.      4,     4,     0,     5,     0,     1,     3,     4,     4,     3,
  244.      3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
  245.      3,     3,     3,     3,     3,     3,     3,     3,     3,     5,
  246.      3,     3,     1,     1,     1,     1,     1,     1,     1,     1,
  247.      1,     1,     4,     1,     1,     1,     3,     3,     3,     4,
  248.      1,     2,     1,     1,     2,     1,     2,     1,     2,     1,
  249.      3,     2,     1,     2,     1,     2,     3,     2,     3,     1,
  250.      3,     6,     8,     9,     1,     1,     1,     1,     2,     3,
  251.      2,     3,     3,     4,     2,     3,     2,     2,     2,     2,
  252.      1,     2,     1,     5,     1,     1,     1,     1,     1,     3,
  253.      1,     1,     1,     1,     1,     1,     1
  254. };
  255.  
  256. static const short yydefact[] = {     0,
  257.     53,    57,    55,    58,    64,   126,    95,    54,    56,     0,
  258.      0,     0,     0,   111,     0,     0,   113,    97,    98,    96,
  259.     60,    61,    62,    65,     0,     0,     0,     0,     0,     0,
  260.    127,     0,     0,     0,     2,     1,     4,     0,    59,    71,
  261.     90,     3,    74,    73,   121,   123,   124,   125,   122,   107,
  262.    108,   109,     0,    15,     0,   115,   117,   118,   116,   110,
  263.     72,     0,   117,   118,   112,   101,    99,   105,     7,     8,
  264.      6,    11,    12,     0,     0,     9,    10,     0,    74,     0,
  265.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  266.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  267.      0,     0,    13,    14,     0,     0,     0,    23,     0,     0,
  268.      0,    78,    76,     0,     0,    75,    80,    83,    85,     0,
  269.      0,   103,   100,   106,     0,   102,    30,     0,     0,     0,
  270.      5,    52,    51,     0,    49,    48,    47,    46,    45,    39,
  271.     40,    43,    44,    41,    42,    37,    38,    31,    35,    36,
  272.     32,    33,    34,   123,     0,    17,    16,     0,    20,    19,
  273.      0,    25,    68,     0,    91,     0,    69,    79,    77,     0,
  274.     86,    88,     0,   119,     0,     0,    82,    84,    63,   104,
  275.      0,    29,    28,     0,    18,    21,    22,    26,     0,     0,
  276.     70,    87,    81,     0,    89,   114,    50,     0,    24,     0,
  277.    120,    27,    92,     0,    93,     0,    94,     0,     0,     0
  278. };
  279.  
  280. static const short yydefgoto[] = {   208,
  281.     35,    74,    37,   162,   189,    38,    39,    40,    41,   116,
  282.    117,   118,   119,   174,    55,    60,   175,   167,    44
  283. };
  284.  
  285. static const short yypact[] = {   202,
  286. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   111,
  287.    111,   111,   264,   158,   111,   111,   176,    25,    10,-32768,
  288. -32768,-32768,-32768,-32768,   202,   202,   202,   202,   202,   202,
  289.     20,   202,   202,   421,-32768,    -6,   454,    23,-32768,-32768,
  290. -32768,    35,   184,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  291. -32768,-32768,   202,   190,    51,-32768,    82,    41,-32768,-32768,
  292. -32768,    60,-32768,-32768,-32768,    81,-32768,-32768,   190,   190,
  293.    190,   190,   190,    -4,   -34,   190,   190,   -38,   371,   202,
  294.    202,   202,   202,   202,   202,   202,   202,   202,   202,   202,
  295.    202,   202,   202,   202,   202,   202,   202,   202,   202,   202,
  296.    202,   202,-32768,-32768,   347,   389,   202,-32768,   111,   421,
  297.     47,   135,   135,     4,   120,-32768,    54,-32768,-32768,   -19,
  298.      2,    84,-32768,-32768,   421,-32768,-32768,   202,   202,    65,
  299.    454,   454,   454,   418,   506,   530,   553,   575,   596,   615,
  300.    615,   249,   249,   249,   249,   368,   368,   627,   637,   637,
  301.    190,   190,   190,    92,   202,-32768,-32768,   202,-32768,-32768,
  302.      3,   202,    99,   110,-32768,   111,-32768,-32768,-32768,    66,
  303. -32768,-32768,    67,    35,    -3,    29,-32768,-32768,   326,-32768,
  304.    -22,   190,   190,   202,   190,   190,-32768,   454,    -1,    86,
  305. -32768,-32768,-32768,   421,-32768,-32768,   481,   202,-32768,    68,
  306.     35,   454,    79,   140,-32768,    38,-32768,   139,   145,-32768
  307. };
  308.  
  309. static const short yypgoto[] = {-32768,
  310. -32768,     6,   -11,-32768,-32768,-32768,-32768,    18,-32768,   -18,
  311. -32768,    31,    33,     1,     0,   129,   -49,    -7,-32768
  312. };
  313.  
  314.  
  315. #define    YYLAST        695
  316.  
  317.  
  318. static const short yytable[] = {    43,
  319.     42,    54,    50,    51,    52,    36,   170,    61,    62,    45,
  320.     46,    47,    48,    69,    70,    71,    72,    73,   196,   110,
  321.     76,    77,    80,   110,    80,   194,   129,   198,   128,    43,
  322.     75,    80,    68,    79,    78,   110,   -66,     7,   110,   109,
  323.     10,    11,    12,   179,    14,    66,    16,    67,    17,    18,
  324.     19,    20,    43,   120,    45,    46,    47,    48,   127,   195,
  325.     49,   199,   166,   124,   187,   171,   194,   121,   131,   132,
  326.    133,   134,   135,   136,   137,   138,   139,   140,   141,   142,
  327.    143,   144,   145,   146,   147,   148,   149,   150,   151,   152,
  328.    153,   172,   110,   168,   169,   165,   173,   157,   160,   125,
  329.    207,   163,   122,   126,   123,    49,   180,   166,   -95,   164,
  330.    114,   176,   161,   165,    79,   -67,   182,   183,    45,    46,
  331.     47,    48,   156,   159,    79,   181,   190,   192,     7,   193,
  332.    203,    10,    11,    12,   200,    14,   204,    16,   209,    17,
  333.     18,    19,    20,   185,   210,    65,   186,   177,     7,   178,
  334.    188,    10,    11,    12,   206,    14,   112,    16,   191,    17,
  335.     18,    19,    20,     0,     0,     0,    56,   182,   113,    49,
  336.      0,   112,   197,     0,     0,    79,   114,   115,    57,    58,
  337.     59,     0,   172,   113,    56,     0,   202,     0,     0,     0,
  338.      0,   114,   115,    79,   201,     0,    63,    64,    59,     0,
  339.    111,     0,   205,    79,     1,     2,     3,     4,     5,     6,
  340.      7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
  341.    112,    17,    18,    19,    20,    21,    22,    23,     0,    24,
  342.      0,     0,   113,     0,     0,     0,     0,     0,    25,     0,
  343.    114,   115,   103,   104,   105,   106,   107,   108,     0,    26,
  344.     27,     0,     0,     0,    28,    29,     0,     0,     0,    30,
  345.     31,    32,    33,     0,     0,    34,     1,     2,     3,     4,
  346.      5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
  347.     15,    16,     0,    17,    18,    19,    20,    21,    22,    23,
  348.      0,    24,    95,    96,    97,    98,    99,   100,   101,   102,
  349.     25,   103,   104,   105,   106,   107,   108,     0,     0,     0,
  350.      0,    26,    27,     0,     0,     0,    28,    29,     0,     0,
  351.      0,    53,    31,    32,    33,     0,     0,    34,     1,     2,
  352.      3,     4,     5,     6,     7,     8,     9,    10,    11,    12,
  353.     13,    14,    15,    16,     0,    17,    18,    19,    20,    21,
  354.     22,    23,     0,    24,    45,   154,    47,    48,    10,    11,
  355.     12,     0,    14,     0,    16,     0,    17,    18,    19,    20,
  356.      0,     0,     0,     0,     0,     0,     0,     0,    28,    29,
  357.      0,     0,     0,    30,    31,    32,    33,   130,     0,    34,
  358.      0,     0,     0,     0,     0,   155,    45,   154,    47,    48,
  359.     10,    11,    12,     0,    14,    49,    16,   112,    17,    18,
  360.     19,    20,     0,    97,    98,    99,   100,   101,   102,   113,
  361.    103,   104,   105,   106,   107,   108,     0,   114,   115,     7,
  362.      0,     0,    10,    11,    12,     0,    14,   158,    16,     0,
  363.     17,    18,    19,    20,    81,     0,     0,    49,    82,    83,
  364.     84,    85,    86,    87,    88,    89,    90,    91,    92,    93,
  365.     94,    95,    96,    97,    98,    99,   100,   101,   102,     0,
  366.    103,   104,   105,   106,   107,   108,     0,     0,     0,     0,
  367.     81,     0,     0,   184,    82,    83,    84,    85,    86,    87,
  368.     88,    89,    90,    91,    92,    93,    94,    95,    96,    97,
  369.     98,    99,   100,   101,   102,     0,   103,   104,   105,   106,
  370.    107,   108,    83,    84,    85,    86,    87,    88,    89,    90,
  371.     91,    92,    93,    94,    95,    96,    97,    98,    99,   100,
  372.    101,   102,     0,   103,   104,   105,   106,   107,   108,    85,
  373.     86,    87,    88,    89,    90,    91,    92,    93,    94,    95,
  374.     96,    97,    98,    99,   100,   101,   102,     0,   103,   104,
  375.    105,   106,   107,   108,    86,    87,    88,    89,    90,    91,
  376.     92,    93,    94,    95,    96,    97,    98,    99,   100,   101,
  377.    102,     0,   103,   104,   105,   106,   107,   108,    87,    88,
  378.     89,    90,    91,    92,    93,    94,    95,    96,    97,    98,
  379.     99,   100,   101,   102,     0,   103,   104,   105,   106,   107,
  380.    108,    88,    89,    90,    91,    92,    93,    94,    95,    96,
  381.     97,    98,    99,   100,   101,   102,     0,   103,   104,   105,
  382.    106,   107,   108,    89,    90,    91,    92,    93,    94,    95,
  383.     96,    97,    98,    99,   100,   101,   102,     0,   103,   104,
  384.    105,   106,   107,   108,    91,    92,    93,    94,    95,    96,
  385.     97,    98,    99,   100,   101,   102,     0,   103,   104,   105,
  386.    106,   107,   108,    98,    99,   100,   101,   102,     0,   103,
  387.    104,   105,   106,   107,   108,   100,   101,   102,     0,   103,
  388.    104,   105,   106,   107,   108
  389. };
  390.  
  391. static const short yycheck[] = {     0,
  392.      0,    13,    10,    11,    12,     0,     3,    15,    16,     8,
  393.      9,    10,    11,    25,    26,    27,    28,    29,    41,    58,
  394.     32,    33,    29,    58,    29,    29,    65,    29,    63,    30,
  395.     30,    29,    23,    34,    34,    58,    17,     9,    58,    17,
  396.     12,    13,    14,    63,    16,    21,    18,    23,    20,    21,
  397.     22,    23,    53,    53,     8,     9,    10,    11,    63,    63,
  398.     59,    63,    61,    23,    62,    62,    29,    17,    80,    81,
  399.     82,    83,    84,    85,    86,    87,    88,    89,    90,    91,
  400.     92,    93,    94,    95,    96,    97,    98,    99,   100,   101,
  401.    102,    63,    58,   112,   113,    49,   115,   105,   106,    40,
  402.     63,   109,    21,    23,    23,    59,    23,    61,    17,   110,
  403.     57,    58,   107,    49,   115,    17,   128,   129,     8,     9,
  404.     10,    11,   105,   106,   125,   125,    17,    62,     9,    63,
  405.     63,    12,    13,    14,    49,    16,    58,    18,     0,    20,
  406.     21,    22,    23,   155,     0,    17,   158,   117,     9,   117,
  407.    162,    12,    13,    14,   204,    16,    37,    18,   166,    20,
  408.     21,    22,    23,    -1,    -1,    -1,     9,   179,    49,    59,
  409.     -1,    37,   184,    -1,    -1,   176,    57,    58,    21,    22,
  410.     23,    -1,    63,    49,     9,    -1,   198,    -1,    -1,    -1,
  411.     -1,    57,    58,   194,   194,    -1,    21,    22,    23,    -1,
  412.     17,    -1,    63,   204,     3,     4,     5,     6,     7,     8,
  413.      9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
  414.     37,    20,    21,    22,    23,    24,    25,    26,    -1,    28,
  415.     -1,    -1,    49,    -1,    -1,    -1,    -1,    -1,    37,    -1,
  416.     57,    58,    53,    54,    55,    56,    57,    58,    -1,    48,
  417.     49,    -1,    -1,    -1,    53,    54,    -1,    -1,    -1,    58,
  418.     59,    60,    61,    -1,    -1,    64,     3,     4,     5,     6,
  419.      7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
  420.     17,    18,    -1,    20,    21,    22,    23,    24,    25,    26,
  421.     -1,    28,    44,    45,    46,    47,    48,    49,    50,    51,
  422.     37,    53,    54,    55,    56,    57,    58,    -1,    -1,    -1,
  423.     -1,    48,    49,    -1,    -1,    -1,    53,    54,    -1,    -1,
  424.     -1,    58,    59,    60,    61,    -1,    -1,    64,     3,     4,
  425.      5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
  426.     15,    16,    17,    18,    -1,    20,    21,    22,    23,    24,
  427.     25,    26,    -1,    28,     8,     9,    10,    11,    12,    13,
  428.     14,    -1,    16,    -1,    18,    -1,    20,    21,    22,    23,
  429.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    53,    54,
  430.     -1,    -1,    -1,    58,    59,    60,    61,    17,    -1,    64,
  431.     -1,    -1,    -1,    -1,    -1,    49,     8,     9,    10,    11,
  432.     12,    13,    14,    -1,    16,    59,    18,    37,    20,    21,
  433.     22,    23,    -1,    46,    47,    48,    49,    50,    51,    49,
  434.     53,    54,    55,    56,    57,    58,    -1,    57,    58,     9,
  435.     -1,    -1,    12,    13,    14,    -1,    16,    49,    18,    -1,
  436.     20,    21,    22,    23,    27,    -1,    -1,    59,    31,    32,
  437.     33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
  438.     43,    44,    45,    46,    47,    48,    49,    50,    51,    -1,
  439.     53,    54,    55,    56,    57,    58,    -1,    -1,    -1,    -1,
  440.     27,    -1,    -1,    66,    31,    32,    33,    34,    35,    36,
  441.     37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
  442.     47,    48,    49,    50,    51,    -1,    53,    54,    55,    56,
  443.     57,    58,    32,    33,    34,    35,    36,    37,    38,    39,
  444.     40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
  445.     50,    51,    -1,    53,    54,    55,    56,    57,    58,    34,
  446.     35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
  447.     45,    46,    47,    48,    49,    50,    51,    -1,    53,    54,
  448.     55,    56,    57,    58,    35,    36,    37,    38,    39,    40,
  449.     41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
  450.     51,    -1,    53,    54,    55,    56,    57,    58,    36,    37,
  451.     38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
  452.     48,    49,    50,    51,    -1,    53,    54,    55,    56,    57,
  453.     58,    37,    38,    39,    40,    41,    42,    43,    44,    45,
  454.     46,    47,    48,    49,    50,    51,    -1,    53,    54,    55,
  455.     56,    57,    58,    38,    39,    40,    41,    42,    43,    44,
  456.     45,    46,    47,    48,    49,    50,    51,    -1,    53,    54,
  457.     55,    56,    57,    58,    40,    41,    42,    43,    44,    45,
  458.     46,    47,    48,    49,    50,    51,    -1,    53,    54,    55,
  459.     56,    57,    58,    47,    48,    49,    50,    51,    -1,    53,
  460.     54,    55,    56,    57,    58,    49,    50,    51,    -1,    53,
  461.     54,    55,    56,    57,    58
  462. };
  463. #define YYPURE 1
  464.  
  465. /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
  466. #line 3 "bison.simple"
  467.  
  468. /* Skeleton output parser for bison,
  469.    Copyright (C) 1984 Bob Corbett and Richard Stallman
  470.  
  471.    This program is free software; you can redistribute it and/or modify
  472.    it under the terms of the GNU General Public License as published by
  473.    the Free Software Foundation; either version 1, or (at your option)
  474.    any later version.
  475.  
  476.    This program is distributed in the hope that it will be useful,
  477.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  478.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  479.    GNU General Public License for more details.
  480.  
  481.    You should have received a copy of the GNU General Public License
  482.    along with this program; if not, write to the Free Software
  483.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  484.  
  485.  
  486. #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__)
  487. #include <alloca.h>
  488. #endif
  489.  
  490. /* This is the parser code that is written into each bison parser
  491.   when the %semantic_parser declaration is not specified in the grammar.
  492.   It was written by Richard Stallman by simplifying the hairy parser
  493.   used when %semantic_parser is specified.  */
  494.  
  495. /* Note: there must be only one dollar sign in this file.
  496.    It is replaced by the list of actions, each action
  497.    as one case of the switch.  */
  498.  
  499. #define yyerrok        (yyerrstatus = 0)
  500. #define yyclearin    (yychar = YYEMPTY)
  501. #define YYEMPTY        -2
  502. #define YYEOF        0
  503. #define YYFAIL        goto yyerrlab;
  504. #define YYACCEPT    return(0)
  505. #define YYABORT     return(1)
  506. #define YYERROR        goto yyerrlab
  507.  
  508. #define YYTERROR    1
  509. #define YYERRCODE    256
  510.  
  511. #ifndef YYIMPURE
  512. #define YYLEX        yylex()
  513. #endif
  514.  
  515. #ifndef YYPURE
  516. #define YYLEX        yylex(&yylval, &yylloc)
  517. #endif
  518.  
  519. /* If nonreentrant, generate the variables here */
  520.  
  521. #ifndef YYIMPURE
  522.  
  523. int    yychar;            /*  the lookahead symbol        */
  524. YYSTYPE    yylval;            /*  the semantic value of the        */
  525.                 /*  lookahead symbol            */
  526.  
  527. YYLTYPE yylloc;            /*  location data for the lookahead    */
  528.                 /*  symbol                */
  529.  
  530. int yynerrs;            /*  number of parse errors so far       */
  531. #endif  /* YYIMPURE */
  532.  
  533. #if YYDEBUG != 0
  534. int yydebug;            /*  nonzero means print parse trace    */
  535. /* Since this is uninitialized, it does not stop multiple parsers
  536.    from coexisting.  */
  537. #endif
  538.  
  539. /*  YYMAXDEPTH indicates the initial size of the parser's stacks    */
  540.  
  541. #ifndef    YYMAXDEPTH
  542. #define YYMAXDEPTH 200
  543. #endif
  544.  
  545. /*  YYMAXLIMIT is the maximum size the stacks can grow to
  546.     (effective only if the built-in stack extension method is used).  */
  547.  
  548. #ifndef YYMAXLIMIT
  549. #define YYMAXLIMIT 10000
  550. #endif
  551.  
  552.  
  553. #line 90 "bison.simple"
  554. int
  555. yyparse()
  556. {
  557.   register int yystate;
  558.   register int yyn;
  559.   register short *yyssp;
  560.   register YYSTYPE *yyvsp;
  561.   YYLTYPE *yylsp;
  562.   int yyerrstatus;    /*  number of tokens to shift before error messages enabled */
  563.   int yychar1;        /*  lookahead token as an internal (translated) token number */
  564.  
  565.   short    yyssa[YYMAXDEPTH];    /*  the state stack            */
  566.   YYSTYPE yyvsa[YYMAXDEPTH];    /*  the semantic value stack        */
  567.   YYLTYPE yylsa[YYMAXDEPTH];    /*  the location stack            */
  568.  
  569.   short *yyss = yyssa;        /*  refer to the stacks thru separate pointers */
  570.   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
  571.   YYLTYPE *yyls = yylsa;
  572.  
  573.   int yymaxdepth = YYMAXDEPTH;
  574.  
  575. #ifndef YYPURE
  576.   int yychar;
  577.   YYSTYPE yylval;
  578.   YYLTYPE yylloc;
  579.   int yynerrs;
  580. #endif
  581.  
  582.   YYSTYPE yyval;        /*  the variable used to return        */
  583.                 /*  semantic values from the action    */
  584.                 /*  routines                */
  585.  
  586.   int yylen;
  587.  
  588. #if YYDEBUG != 0
  589.   if (yydebug)
  590.     fprintf(stderr, "Starting parse\n");
  591. #endif
  592.  
  593.   yystate = 0;
  594.   yyerrstatus = 0;
  595.   yynerrs = 0;
  596.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  597.  
  598.   /* Initialize stack pointers.
  599.      Waste one element of value and location stack
  600.      so that they stay on the same level as the state stack.  */
  601.  
  602.   yyssp = yyss - 1;
  603.   yyvsp = yyvs;
  604.   yylsp = yyls;
  605.  
  606. /* Push a new state, which is found in  yystate  .  */
  607. /* In all cases, when you get here, the value and location stacks
  608.    have just been pushed. so pushing a state here evens the stacks.  */
  609. yynewstate:
  610.  
  611.   *++yyssp = yystate;
  612.  
  613.   if (yyssp >= yyss + yymaxdepth - 1)
  614.     {
  615.       /* Give user a chance to reallocate the stack */
  616.       /* Use copies of these so that the &'s don't force the real ones into memory. */
  617.       YYSTYPE *yyvs1 = yyvs;
  618.       YYLTYPE *yyls1 = yyls;
  619.       short *yyss1 = yyss;
  620.  
  621.       /* Get the current used size of the three stacks, in elements.  */
  622.       int size = yyssp - yyss + 1;
  623.  
  624. #ifdef yyoverflow
  625.       /* Each stack pointer address is followed by the size of
  626.      the data in use in that stack, in bytes.  */
  627.       yyoverflow("parser stack overflow",
  628.          &yyss1, size * sizeof (*yyssp),
  629.          &yyvs1, size * sizeof (*yyvsp),
  630.          &yyls1, size * sizeof (*yylsp),
  631.          &yymaxdepth);
  632.  
  633.       yyss = yyss1; yyvs = yyvs1; yyls = yyls1;
  634. #else /* no yyoverflow */
  635.       /* Extend the stack our own way.  */
  636.       if (yymaxdepth >= YYMAXLIMIT)
  637.     yyerror("parser stack overflow");
  638.       yymaxdepth *= 2;
  639.       if (yymaxdepth > YYMAXLIMIT)
  640.     yymaxdepth = YYMAXLIMIT;
  641.       yyss = (short *) alloca (yymaxdepth * sizeof (*yyssp));
  642.       bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
  643.       yyvs = (YYSTYPE *) alloca (yymaxdepth * sizeof (*yyvsp));
  644.       bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
  645. #ifdef YYLSP_NEEDED
  646.       yyls = (YYLTYPE *) alloca (yymaxdepth * sizeof (*yylsp));
  647.       bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
  648. #endif
  649. #endif /* no yyoverflow */
  650.  
  651.       yyssp = yyss + size - 1;
  652.       yyvsp = yyvs + size - 1;
  653. #ifdef YYLSP_NEEDED
  654.       yylsp = yyls + size - 1;
  655. #endif
  656.  
  657. #if YYDEBUG != 0
  658.       if (yydebug)
  659.     fprintf(stderr, "Stack size increased to %d\n", yymaxdepth);
  660. #endif
  661.  
  662.       if (yyssp >= yyss + yymaxdepth - 1)
  663.     YYABORT;
  664.     }
  665.  
  666. #if YYDEBUG != 0
  667.   if (yydebug)
  668.     fprintf(stderr, "Entering state %d\n", yystate);
  669. #endif
  670.  
  671. /* Do appropriate processing given the current state.  */
  672. /* Read a lookahead token if we need one and don't already have one.  */
  673. yyresume:
  674.  
  675.   /* First try to decide what to do without reference to lookahead token.  */
  676.  
  677.   yyn = yypact[yystate];
  678.   if (yyn == YYFLAG)
  679.     goto yydefault;
  680.  
  681.   /* Not known => get a lookahead token if don't already have one.  */
  682.  
  683.   /* yychar is either YYEMPTY or YYEOF
  684.      or a valid token in external form.  */
  685.  
  686.   if (yychar == YYEMPTY)
  687.     {
  688. #if YYDEBUG != 0
  689.       if (yydebug)
  690.     fprintf(stderr, "Reading a token: ");
  691. #endif
  692.       yychar = YYLEX;
  693.     }
  694.  
  695.   /* Convert token to internal form (in yychar1) for indexing tables with */
  696.  
  697.   if (yychar <= 0)        /* This means end of input. */
  698.     {
  699.       yychar1 = 0;
  700.       yychar = YYEOF;        /* Don't call YYLEX any more */
  701.  
  702. #if YYDEBUG != 0
  703.       if (yydebug)
  704.     fprintf(stderr, "Now at end of input.\n");
  705. #endif
  706.     }
  707.   else
  708.     {
  709.       yychar1 = YYTRANSLATE(yychar);
  710.  
  711. #if YYDEBUG != 0
  712.       if (yydebug)
  713.     fprintf(stderr, "Next token is %d (%s)\n", yychar, yytname[yychar1]);
  714. #endif
  715.     }
  716.  
  717.   yyn += yychar1;
  718.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  719.     goto yydefault;
  720.  
  721.   yyn = yytable[yyn];
  722.  
  723.   /* yyn is what to do for this token type in this state.
  724.      Negative => reduce, -yyn is rule number.
  725.      Positive => shift, yyn is new state.
  726.        New state is final state => don't bother to shift,
  727.        just return success.
  728.      0, or most negative number => error.  */
  729.  
  730.   if (yyn < 0)
  731.     {
  732.       if (yyn == YYFLAG)
  733.     goto yyerrlab;
  734.       yyn = -yyn;
  735.       goto yyreduce;
  736.     }
  737.   else if (yyn == 0)
  738.     goto yyerrlab;
  739.  
  740.   if (yyn == YYFINAL)
  741.     YYACCEPT;
  742.  
  743.   /* Shift the lookahead token.  */
  744.  
  745. #if YYDEBUG != 0
  746.   if (yydebug)
  747.     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  748. #endif
  749.  
  750.   /* Discard the token being shifted unless it is eof.  */
  751.   if (yychar != YYEOF)
  752.     yychar = YYEMPTY;
  753.  
  754.   *++yyvsp = yylval;
  755. #ifdef YYLSP_NEEDED
  756.   *++yylsp = yylloc;
  757. #endif
  758.  
  759.   /* count tokens shifted since error; after three, turn off error status.  */
  760.   if (yyerrstatus) yyerrstatus--;
  761.  
  762.   yystate = yyn;
  763.   goto yynewstate;
  764.  
  765. /* Do the default action for the current state.  */
  766. yydefault:
  767.  
  768.   yyn = yydefact[yystate];
  769.   if (yyn == 0)
  770.     goto yyerrlab;
  771.  
  772. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  773. yyreduce:
  774.   yylen = yyr2[yyn];
  775.   yyval = yyvsp[1-yylen]; /* implement default value of the action */
  776.  
  777. #if YYDEBUG != 0
  778.   if (yydebug)
  779.     {
  780.       if (yylen == 1)
  781.     fprintf (stderr, "Reducing 1 value via line %d, ",
  782.          yyrline[yyn]);
  783.       else
  784.     fprintf (stderr, "Reducing %d values via line %d, ",
  785.          yylen, yyrline[yyn]);
  786.     }
  787. #endif
  788.  
  789.  
  790.   switch (yyn) {
  791.  
  792. case 3:
  793. #line 204 "./c-exp.y"
  794. { write_exp_elt_opcode(OP_TYPE);
  795.               write_exp_elt_type(yyvsp[0].tval);
  796.               write_exp_elt_opcode(OP_TYPE);;
  797.     break;}
  798. case 5:
  799. #line 212 "./c-exp.y"
  800. { write_exp_elt_opcode (BINOP_COMMA); ;
  801.     break;}
  802. case 6:
  803. #line 217 "./c-exp.y"
  804. { write_exp_elt_opcode (UNOP_IND); ;
  805.     break;}
  806. case 7:
  807. #line 220 "./c-exp.y"
  808. { write_exp_elt_opcode (UNOP_ADDR); ;
  809.     break;}
  810. case 8:
  811. #line 223 "./c-exp.y"
  812. { write_exp_elt_opcode (UNOP_NEG); ;
  813.     break;}
  814. case 9:
  815. #line 227 "./c-exp.y"
  816. { write_exp_elt_opcode (UNOP_ZEROP); ;
  817.     break;}
  818. case 10:
  819. #line 231 "./c-exp.y"
  820. { write_exp_elt_opcode (UNOP_LOGNOT); ;
  821.     break;}
  822. case 11:
  823. #line 235 "./c-exp.y"
  824. { write_exp_elt_opcode (UNOP_PREINCREMENT); ;
  825.     break;}
  826. case 12:
  827. #line 239 "./c-exp.y"
  828. { write_exp_elt_opcode (UNOP_PREDECREMENT); ;
  829.     break;}
  830. case 13:
  831. #line 243 "./c-exp.y"
  832. { write_exp_elt_opcode (UNOP_POSTINCREMENT); ;
  833.     break;}
  834. case 14:
  835. #line 247 "./c-exp.y"
  836. { write_exp_elt_opcode (UNOP_POSTDECREMENT); ;
  837.     break;}
  838. case 15:
  839. #line 251 "./c-exp.y"
  840. { write_exp_elt_opcode (UNOP_SIZEOF); ;
  841.     break;}
  842. case 16:
  843. #line 255 "./c-exp.y"
  844. { write_exp_elt_opcode (STRUCTOP_PTR);
  845.               write_exp_string (yyvsp[0].sval);
  846.               write_exp_elt_opcode (STRUCTOP_PTR); ;
  847.     break;}
  848. case 17:
  849. #line 261 "./c-exp.y"
  850. { /* exp->type::name becomes exp->*(&type::name) */
  851.               /* Note: this doesn't work if name is a
  852.                  static member!  FIXME */
  853.               write_exp_elt_opcode (UNOP_ADDR);
  854.               write_exp_elt_opcode (STRUCTOP_MPTR); ;
  855.     break;}
  856. case 18:
  857. #line 268 "./c-exp.y"
  858. { write_exp_elt_opcode (STRUCTOP_MPTR); ;
  859.     break;}
  860. case 19:
  861. #line 272 "./c-exp.y"
  862. { write_exp_elt_opcode (STRUCTOP_STRUCT);
  863.               write_exp_string (yyvsp[0].sval);
  864.               write_exp_elt_opcode (STRUCTOP_STRUCT); ;
  865.     break;}
  866. case 20:
  867. #line 278 "./c-exp.y"
  868. { /* exp.type::name becomes exp.*(&type::name) */
  869.               /* Note: this doesn't work if name is a
  870.                  static member!  FIXME */
  871.               write_exp_elt_opcode (UNOP_ADDR);
  872.               write_exp_elt_opcode (STRUCTOP_MEMBER); ;
  873.     break;}
  874. case 21:
  875. #line 286 "./c-exp.y"
  876. { write_exp_elt_opcode (STRUCTOP_MEMBER); ;
  877.     break;}
  878. case 22:
  879. #line 290 "./c-exp.y"
  880. { write_exp_elt_opcode (BINOP_SUBSCRIPT); ;
  881.     break;}
  882. case 23:
  883. #line 296 "./c-exp.y"
  884. { start_arglist (); ;
  885.     break;}
  886. case 24:
  887. #line 298 "./c-exp.y"
  888. { write_exp_elt_opcode (OP_FUNCALL);
  889.               write_exp_elt_longcst ((LONGEST) end_arglist ());
  890.               write_exp_elt_opcode (OP_FUNCALL); ;
  891.     break;}
  892. case 26:
  893. #line 307 "./c-exp.y"
  894. { arglist_len = 1; ;
  895.     break;}
  896. case 27:
  897. #line 311 "./c-exp.y"
  898. { arglist_len++; ;
  899.     break;}
  900. case 28:
  901. #line 315 "./c-exp.y"
  902. { write_exp_elt_opcode (UNOP_MEMVAL);
  903.               write_exp_elt_type (yyvsp[-2].tval);
  904.               write_exp_elt_opcode (UNOP_MEMVAL); ;
  905.     break;}
  906. case 29:
  907. #line 321 "./c-exp.y"
  908. { write_exp_elt_opcode (UNOP_CAST);
  909.               write_exp_elt_type (yyvsp[-2].tval);
  910.               write_exp_elt_opcode (UNOP_CAST); ;
  911.     break;}
  912. case 30:
  913. #line 327 "./c-exp.y"
  914. { ;
  915.     break;}
  916. case 31:
  917. #line 333 "./c-exp.y"
  918. { write_exp_elt_opcode (BINOP_REPEAT); ;
  919.     break;}
  920. case 32:
  921. #line 337 "./c-exp.y"
  922. { write_exp_elt_opcode (BINOP_MUL); ;
  923.     break;}
  924. case 33:
  925. #line 341 "./c-exp.y"
  926. { write_exp_elt_opcode (BINOP_DIV); ;
  927.     break;}
  928. case 34:
  929. #line 345 "./c-exp.y"
  930. { write_exp_elt_opcode (BINOP_REM); ;
  931.     break;}
  932. case 35:
  933. #line 349 "./c-exp.y"
  934. { write_exp_elt_opcode (BINOP_ADD); ;
  935.     break;}
  936. case 36:
  937. #line 353 "./c-exp.y"
  938. { write_exp_elt_opcode (BINOP_SUB); ;
  939.     break;}
  940. case 37:
  941. #line 357 "./c-exp.y"
  942. { write_exp_elt_opcode (BINOP_LSH); ;
  943.     break;}
  944. case 38:
  945. #line 361 "./c-exp.y"
  946. { write_exp_elt_opcode (BINOP_RSH); ;
  947.     break;}
  948. case 39:
  949. #line 365 "./c-exp.y"
  950. { write_exp_elt_opcode (BINOP_EQUAL); ;
  951.     break;}
  952. case 40:
  953. #line 369 "./c-exp.y"
  954. { write_exp_elt_opcode (BINOP_NOTEQUAL); ;
  955.     break;}
  956. case 41:
  957. #line 373 "./c-exp.y"
  958. { write_exp_elt_opcode (BINOP_LEQ); ;
  959.     break;}
  960. case 42:
  961. #line 377 "./c-exp.y"
  962. { write_exp_elt_opcode (BINOP_GEQ); ;
  963.     break;}
  964. case 43:
  965. #line 381 "./c-exp.y"
  966. { write_exp_elt_opcode (BINOP_LESS); ;
  967.     break;}
  968. case 44:
  969. #line 385 "./c-exp.y"
  970. { write_exp_elt_opcode (BINOP_GTR); ;
  971.     break;}
  972. case 45:
  973. #line 389 "./c-exp.y"
  974. { write_exp_elt_opcode (BINOP_LOGAND); ;
  975.     break;}
  976. case 46:
  977. #line 393 "./c-exp.y"
  978. { write_exp_elt_opcode (BINOP_LOGXOR); ;
  979.     break;}
  980. case 47:
  981. #line 397 "./c-exp.y"
  982. { write_exp_elt_opcode (BINOP_LOGIOR); ;
  983.     break;}
  984. case 48:
  985. #line 401 "./c-exp.y"
  986. { write_exp_elt_opcode (BINOP_AND); ;
  987.     break;}
  988. case 49:
  989. #line 405 "./c-exp.y"
  990. { write_exp_elt_opcode (BINOP_OR); ;
  991.     break;}
  992. case 50:
  993. #line 409 "./c-exp.y"
  994. { write_exp_elt_opcode (TERNOP_COND); ;
  995.     break;}
  996. case 51:
  997. #line 413 "./c-exp.y"
  998. { write_exp_elt_opcode (BINOP_ASSIGN); ;
  999.     break;}
  1000. case 52:
  1001. #line 417 "./c-exp.y"
  1002. { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
  1003.               write_exp_elt_opcode (yyvsp[-1].opcode);
  1004.               write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); ;
  1005.     break;}
  1006. case 53:
  1007. #line 423 "./c-exp.y"
  1008. { write_exp_elt_opcode (OP_LONG);
  1009.               if (yyvsp[0].lval == (int) yyvsp[0].lval || yyvsp[0].lval == (unsigned int) yyvsp[0].lval)
  1010.                 write_exp_elt_type (builtin_type_int);
  1011.               else
  1012.                 write_exp_elt_type (BUILTIN_TYPE_LONGEST);
  1013.               write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
  1014.               write_exp_elt_opcode (OP_LONG); ;
  1015.     break;}
  1016. case 54:
  1017. #line 433 "./c-exp.y"
  1018. { YYSTYPE val;
  1019.               parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
  1020.               write_exp_elt_opcode (OP_LONG);
  1021.               if (val.lval == (int) val.lval ||
  1022.                   val.lval == (unsigned int) val.lval)
  1023.                 write_exp_elt_type (builtin_type_int);
  1024.               else
  1025.                 write_exp_elt_type (BUILTIN_TYPE_LONGEST);
  1026.               write_exp_elt_longcst (val.lval);
  1027.               write_exp_elt_opcode (OP_LONG); ;
  1028.     break;}
  1029. case 55:
  1030. #line 446 "./c-exp.y"
  1031. {
  1032.               write_exp_elt_opcode (OP_LONG);
  1033.               if (yyvsp[0].ulval == (unsigned int) yyvsp[0].ulval)
  1034.                 write_exp_elt_type (builtin_type_unsigned_int);
  1035.               else
  1036.                 write_exp_elt_type (BUILTIN_TYPE_UNSIGNED_LONGEST);
  1037.               write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
  1038.               write_exp_elt_opcode (OP_LONG);
  1039.             ;
  1040.     break;}
  1041. case 56:
  1042. #line 458 "./c-exp.y"
  1043. { YYSTYPE val;
  1044.               parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
  1045.               write_exp_elt_opcode (OP_LONG);
  1046.               if (val.ulval == (unsigned int) val.ulval)
  1047.                 write_exp_elt_type (builtin_type_unsigned_int);
  1048.               else
  1049.                 write_exp_elt_type (BUILTIN_TYPE_UNSIGNED_LONGEST);
  1050.               write_exp_elt_longcst ((LONGEST)val.ulval);
  1051.               write_exp_elt_opcode (OP_LONG);
  1052.             ;
  1053.     break;}
  1054. case 57:
  1055. #line 471 "./c-exp.y"
  1056. { write_exp_elt_opcode (OP_LONG);
  1057.               write_exp_elt_type (builtin_type_char);
  1058.               write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
  1059.               write_exp_elt_opcode (OP_LONG); ;
  1060.     break;}
  1061. case 58:
  1062. #line 478 "./c-exp.y"
  1063. { write_exp_elt_opcode (OP_DOUBLE);
  1064.               write_exp_elt_type (builtin_type_double);
  1065.               write_exp_elt_dblcst (yyvsp[0].dval);
  1066.               write_exp_elt_opcode (OP_DOUBLE); ;
  1067.     break;}
  1068. case 60:
  1069. #line 488 "./c-exp.y"
  1070. { write_exp_elt_opcode (OP_LAST);
  1071.               write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
  1072.               write_exp_elt_opcode (OP_LAST); ;
  1073.     break;}
  1074. case 61:
  1075. #line 494 "./c-exp.y"
  1076. { write_exp_elt_opcode (OP_REGISTER);
  1077.               write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
  1078.               write_exp_elt_opcode (OP_REGISTER); ;
  1079.     break;}
  1080. case 62:
  1081. #line 500 "./c-exp.y"
  1082. { write_exp_elt_opcode (OP_INTERNALVAR);
  1083.               write_exp_elt_intern (yyvsp[0].ivar);
  1084.               write_exp_elt_opcode (OP_INTERNALVAR); ;
  1085.     break;}
  1086. case 63:
  1087. #line 506 "./c-exp.y"
  1088. { write_exp_elt_opcode (OP_LONG);
  1089.               write_exp_elt_type (builtin_type_int);
  1090.               write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
  1091.               write_exp_elt_opcode (OP_LONG); ;
  1092.     break;}
  1093. case 64:
  1094. #line 513 "./c-exp.y"
  1095. { write_exp_elt_opcode (OP_STRING);
  1096.               write_exp_string (yyvsp[0].sval);
  1097.               write_exp_elt_opcode (OP_STRING); ;
  1098.     break;}
  1099. case 65:
  1100. #line 520 "./c-exp.y"
  1101. { write_exp_elt_opcode (OP_THIS);
  1102.               write_exp_elt_opcode (OP_THIS); ;
  1103.     break;}
  1104. case 66:
  1105. #line 527 "./c-exp.y"
  1106. {
  1107.               if (yyvsp[0].ssym.sym != 0)
  1108.                   yyval.bval = SYMBOL_BLOCK_VALUE (yyvsp[0].ssym.sym);
  1109.               else
  1110.                 {
  1111.                   struct symtab *tem =
  1112.                   lookup_symtab (copy_name (yyvsp[0].ssym.stoken));
  1113.                   if (tem)
  1114.                 yyval.bval = BLOCKVECTOR_BLOCK
  1115.                      (BLOCKVECTOR (tem), STATIC_BLOCK);
  1116.                   else
  1117.                 error ("No file or function \"%s\".",
  1118.                        copy_name (yyvsp[0].ssym.stoken));
  1119.                 }
  1120.             ;
  1121.     break;}
  1122. case 67:
  1123. #line 545 "./c-exp.y"
  1124. { struct symbol *tem
  1125.                 = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
  1126.                          VAR_NAMESPACE, 0, NULL);
  1127.               if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
  1128.                 error ("No function \"%s\" in specified context.",
  1129.                    copy_name (yyvsp[0].sval));
  1130.               yyval.bval = SYMBOL_BLOCK_VALUE (tem); ;
  1131.     break;}
  1132. case 68:
  1133. #line 555 "./c-exp.y"
  1134. { struct symbol *sym;
  1135.               sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
  1136.                            VAR_NAMESPACE, 0, NULL);
  1137.               if (sym == 0)
  1138.                 error ("No symbol \"%s\" in specified context.",
  1139.                    copy_name (yyvsp[0].sval));
  1140.  
  1141.               write_exp_elt_opcode (OP_VAR_VALUE);
  1142.               write_exp_elt_sym (sym);
  1143.               write_exp_elt_opcode (OP_VAR_VALUE); ;
  1144.     break;}
  1145. case 69:
  1146. #line 568 "./c-exp.y"
  1147. {
  1148.               struct type *type = yyvsp[-2].tval;
  1149.               if (TYPE_CODE (type) != TYPE_CODE_STRUCT
  1150.                   && TYPE_CODE (type) != TYPE_CODE_UNION)
  1151.                 error ("`%s' is not defined as an aggregate type.",
  1152.                    TYPE_NAME (type));
  1153.  
  1154.               write_exp_elt_opcode (OP_SCOPE);
  1155.               write_exp_elt_type (type);
  1156.               write_exp_string (yyvsp[0].sval);
  1157.               write_exp_elt_opcode (OP_SCOPE);
  1158.             ;
  1159.     break;}
  1160. case 70:
  1161. #line 581 "./c-exp.y"
  1162. {
  1163.               struct type *type = yyvsp[-3].tval;
  1164.               struct stoken tmp_token;
  1165.               if (TYPE_CODE (type) != TYPE_CODE_STRUCT
  1166.                   && TYPE_CODE (type) != TYPE_CODE_UNION)
  1167.                 error ("`%s' is not defined as an aggregate type.",
  1168.                    TYPE_NAME (type));
  1169.  
  1170.               if (strcmp (type_name_no_tag (type), yyvsp[0].sval.ptr))
  1171.                 error ("invalid destructor `%s::~%s'",
  1172.                    type_name_no_tag (type), yyvsp[0].sval.ptr);
  1173.  
  1174.               tmp_token.ptr = (char*) alloca (yyvsp[0].sval.length + 2);
  1175.               tmp_token.length = yyvsp[0].sval.length + 1;
  1176.               tmp_token.ptr[0] = '~';
  1177.               memcpy (tmp_token.ptr+1, yyvsp[0].sval.ptr, yyvsp[0].sval.length);
  1178.               tmp_token.ptr[tmp_token.length] = 0;
  1179.               write_exp_elt_opcode (OP_SCOPE);
  1180.               write_exp_elt_type (type);
  1181.               write_exp_string (tmp_token);
  1182.               write_exp_elt_opcode (OP_SCOPE);
  1183.             ;
  1184.     break;}
  1185. case 72:
  1186. #line 607 "./c-exp.y"
  1187. {
  1188.               char *name = copy_name (yyvsp[0].sval);
  1189.               struct symbol *sym;
  1190.               struct minimal_symbol *msymbol;
  1191.  
  1192.               sym =
  1193.                 lookup_symbol (name, 0, VAR_NAMESPACE, 0, NULL);
  1194.               if (sym)
  1195.                 {
  1196.                   write_exp_elt_opcode (OP_VAR_VALUE);
  1197.                   write_exp_elt_sym (sym);
  1198.                   write_exp_elt_opcode (OP_VAR_VALUE);
  1199.                   break;
  1200.                 }
  1201.  
  1202.               msymbol = lookup_minimal_symbol (name,
  1203.                       (struct objfile *) NULL);
  1204.               if (msymbol != NULL)
  1205.                 {
  1206.                   write_exp_elt_opcode (OP_LONG);
  1207.                   write_exp_elt_type (builtin_type_int);
  1208.                   write_exp_elt_longcst ((LONGEST) msymbol -> address);
  1209.                   write_exp_elt_opcode (OP_LONG);
  1210.                   write_exp_elt_opcode (UNOP_MEMVAL);
  1211.                   if (msymbol -> type == mst_data ||
  1212.                   msymbol -> type == mst_bss)
  1213.                 write_exp_elt_type (builtin_type_int);
  1214.                   else if (msymbol -> type == mst_text)
  1215.                 write_exp_elt_type (lookup_function_type (builtin_type_int));
  1216.                   else
  1217.                 write_exp_elt_type (builtin_type_char);
  1218.                   write_exp_elt_opcode (UNOP_MEMVAL);
  1219.                 }
  1220.               else
  1221.                 if (!have_full_symbols () && !have_partial_symbols ())
  1222.                   error ("No symbol table is loaded.  Use the \"file\" command.");
  1223.                 else
  1224.                   error ("No symbol \"%s\" in current context.", name);
  1225.             ;
  1226.     break;}
  1227. case 73:
  1228. #line 649 "./c-exp.y"
  1229. { struct symbol *sym = yyvsp[0].ssym.sym;
  1230.  
  1231.               if (sym)
  1232.                 {
  1233.                   switch (SYMBOL_CLASS (sym))
  1234.                 {
  1235.                 case LOC_REGISTER:
  1236.                 case LOC_ARG:
  1237.                 case LOC_REF_ARG:
  1238.                 case LOC_REGPARM:
  1239.                 case LOC_LOCAL:
  1240.                 case LOC_LOCAL_ARG:
  1241.                   if (innermost_block == 0 ||
  1242.                       contained_in (block_found, 
  1243.                             innermost_block))
  1244.                     innermost_block = block_found;
  1245.                 case LOC_UNDEF:
  1246.                 case LOC_CONST:
  1247.                 case LOC_STATIC:
  1248.                 case LOC_TYPEDEF:
  1249.                 case LOC_LABEL:
  1250.                 case LOC_BLOCK:
  1251.                 case LOC_CONST_BYTES:
  1252.  
  1253.                   /* In this case the expression can
  1254.                      be evaluated regardless of what
  1255.                      frame we are in, so there is no
  1256.                      need to check for the
  1257.                      innermost_block.  These cases are
  1258.                      listed so that gcc -Wall will
  1259.                      report types that may not have
  1260.                      been considered.  */
  1261.  
  1262.                   break;
  1263.                 }
  1264.                   write_exp_elt_opcode (OP_VAR_VALUE);
  1265.                   write_exp_elt_sym (sym);
  1266.                   write_exp_elt_opcode (OP_VAR_VALUE);
  1267.                 }
  1268.               else if (yyvsp[0].ssym.is_a_field_of_this)
  1269.                 {
  1270.                   /* C++: it hangs off of `this'.  Must
  1271.                      not inadvertently convert from a method call
  1272.                  to data ref.  */
  1273.                   if (innermost_block == 0 || 
  1274.                   contained_in (block_found, innermost_block))
  1275.                 innermost_block = block_found;
  1276.                   write_exp_elt_opcode (OP_THIS);
  1277.                   write_exp_elt_opcode (OP_THIS);
  1278.                   write_exp_elt_opcode (STRUCTOP_PTR);
  1279.                   write_exp_string (yyvsp[0].ssym.stoken);
  1280.                   write_exp_elt_opcode (STRUCTOP_PTR);
  1281.                 }
  1282.               else
  1283.                 {
  1284.                   struct minimal_symbol *msymbol;
  1285.                   register char *arg = copy_name (yyvsp[0].ssym.stoken);
  1286.  
  1287.                   msymbol = lookup_minimal_symbol (arg,
  1288.                       (struct objfile *) NULL);
  1289.                   if (msymbol != NULL)
  1290.                 {
  1291.                   write_exp_elt_opcode (OP_LONG);
  1292.                   write_exp_elt_type (builtin_type_int);
  1293.                   write_exp_elt_longcst ((LONGEST) msymbol -> address);
  1294.                   write_exp_elt_opcode (OP_LONG);
  1295.                   write_exp_elt_opcode (UNOP_MEMVAL);
  1296.                   if (msymbol -> type == mst_data ||
  1297.                       msymbol -> type == mst_bss)
  1298.                     write_exp_elt_type (builtin_type_int);
  1299.                   else if (msymbol -> type == mst_text)
  1300.                     write_exp_elt_type (lookup_function_type (builtin_type_int));
  1301.                   else
  1302.                     write_exp_elt_type (builtin_type_char);
  1303.                   write_exp_elt_opcode (UNOP_MEMVAL);
  1304.                 }
  1305.                   else if (!have_full_symbols () && !have_partial_symbols ())
  1306.                 error ("No symbol table is loaded.  Use the \"file\" command.");
  1307.                   else
  1308.                 error ("No symbol \"%s\" in current context.",
  1309.                        copy_name (yyvsp[0].ssym.stoken));
  1310.                 }
  1311.             ;
  1312.     break;}
  1313. case 75:
  1314. #line 737 "./c-exp.y"
  1315. {
  1316.           /* This is where the interesting stuff happens.  */
  1317.           int done = 0;
  1318.           int array_size;
  1319.           struct type *follow_type = yyvsp[-1].tval;
  1320.           
  1321.           while (!done)
  1322.             switch (pop_type ())
  1323.               {
  1324.               case tp_end:
  1325.             done = 1;
  1326.             break;
  1327.               case tp_pointer:
  1328.             follow_type = lookup_pointer_type (follow_type);
  1329.             break;
  1330.               case tp_reference:
  1331.             follow_type = lookup_reference_type (follow_type);
  1332.             break;
  1333.               case tp_array:
  1334.             array_size = pop_type_int ();
  1335.             if (array_size != -1)
  1336.               follow_type = create_array_type (follow_type,
  1337.                                array_size);
  1338.             else
  1339.               follow_type = lookup_pointer_type (follow_type);
  1340.             break;
  1341.               case tp_function:
  1342.             follow_type = lookup_function_type (follow_type);
  1343.             break;
  1344.               }
  1345.           yyval.tval = follow_type;
  1346.         ;
  1347.     break;}
  1348. case 76:
  1349. #line 772 "./c-exp.y"
  1350. { push_type (tp_pointer); yyval.voidval = 0; ;
  1351.     break;}
  1352. case 77:
  1353. #line 774 "./c-exp.y"
  1354. { push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; ;
  1355.     break;}
  1356. case 78:
  1357. #line 776 "./c-exp.y"
  1358. { push_type (tp_reference); yyval.voidval = 0; ;
  1359.     break;}
  1360. case 79:
  1361. #line 778 "./c-exp.y"
  1362. { push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; ;
  1363.     break;}
  1364. case 81:
  1365. #line 783 "./c-exp.y"
  1366. { yyval.voidval = yyvsp[-1].voidval; ;
  1367.     break;}
  1368. case 82:
  1369. #line 785 "./c-exp.y"
  1370. {
  1371.               push_type_int (yyvsp[0].lval);
  1372.               push_type (tp_array);
  1373.             ;
  1374.     break;}
  1375. case 83:
  1376. #line 790 "./c-exp.y"
  1377. {
  1378.               push_type_int (yyvsp[0].lval);
  1379.               push_type (tp_array);
  1380.               yyval.voidval = 0;
  1381.             ;
  1382.     break;}
  1383. case 84:
  1384. #line 796 "./c-exp.y"
  1385. { push_type (tp_function); ;
  1386.     break;}
  1387. case 85:
  1388. #line 798 "./c-exp.y"
  1389. { push_type (tp_function); ;
  1390.     break;}
  1391. case 86:
  1392. #line 802 "./c-exp.y"
  1393. { yyval.lval = -1; ;
  1394.     break;}
  1395. case 87:
  1396. #line 804 "./c-exp.y"
  1397. { yyval.lval = yyvsp[-1].lval; ;
  1398.     break;}
  1399. case 88:
  1400. #line 808 "./c-exp.y"
  1401. { yyval.voidval = 0; ;
  1402.     break;}
  1403. case 89:
  1404. #line 810 "./c-exp.y"
  1405. { free ((PTR)yyvsp[-1].tvec); yyval.voidval = 0; ;
  1406.     break;}
  1407. case 91:
  1408. #line 815 "./c-exp.y"
  1409. { yyval.tval = lookup_member_type (builtin_type_int, yyvsp[-2].tval); ;
  1410.     break;}
  1411. case 92:
  1412. #line 817 "./c-exp.y"
  1413. { yyval.tval = lookup_member_type (yyvsp[-5].tval, yyvsp[-3].tval); ;
  1414.     break;}
  1415. case 93:
  1416. #line 819 "./c-exp.y"
  1417. { yyval.tval = lookup_member_type
  1418.                 (lookup_function_type (yyvsp[-7].tval), yyvsp[-5].tval); ;
  1419.     break;}
  1420. case 94:
  1421. #line 822 "./c-exp.y"
  1422. { yyval.tval = lookup_member_type
  1423.                 (lookup_function_type (yyvsp[-8].tval), yyvsp[-6].tval);
  1424.               free ((PTR)yyvsp[-1].tvec); ;
  1425.     break;}
  1426. case 95:
  1427. #line 829 "./c-exp.y"
  1428. { yyval.tval = yyvsp[0].tsym.type; ;
  1429.     break;}
  1430. case 96:
  1431. #line 831 "./c-exp.y"
  1432. { yyval.tval = builtin_type_int; ;
  1433.     break;}
  1434. case 97:
  1435. #line 833 "./c-exp.y"
  1436. { yyval.tval = builtin_type_long; ;
  1437.     break;}
  1438. case 98:
  1439. #line 835 "./c-exp.y"
  1440. { yyval.tval = builtin_type_short; ;
  1441.     break;}
  1442. case 99:
  1443. #line 837 "./c-exp.y"
  1444. { yyval.tval = builtin_type_long; ;
  1445.     break;}
  1446. case 100:
  1447. #line 839 "./c-exp.y"
  1448. { yyval.tval = builtin_type_unsigned_long; ;
  1449.     break;}
  1450. case 101:
  1451. #line 841 "./c-exp.y"
  1452. { yyval.tval = builtin_type_long_long; ;
  1453.     break;}
  1454. case 102:
  1455. #line 843 "./c-exp.y"
  1456. { yyval.tval = builtin_type_long_long; ;
  1457.     break;}
  1458. case 103:
  1459. #line 845 "./c-exp.y"
  1460. { yyval.tval = builtin_type_unsigned_long_long; ;
  1461.     break;}
  1462. case 104:
  1463. #line 847 "./c-exp.y"
  1464. { yyval.tval = builtin_type_unsigned_long_long; ;
  1465.     break;}
  1466. case 105:
  1467. #line 849 "./c-exp.y"
  1468. { yyval.tval = builtin_type_short; ;
  1469.     break;}
  1470. case 106:
  1471. #line 851 "./c-exp.y"
  1472. { yyval.tval = builtin_type_unsigned_short; ;
  1473.     break;}
  1474. case 107:
  1475. #line 853 "./c-exp.y"
  1476. { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
  1477.                           expression_context_block); ;
  1478.     break;}
  1479. case 108:
  1480. #line 856 "./c-exp.y"
  1481. { yyval.tval = lookup_union (copy_name (yyvsp[0].sval),
  1482.                          expression_context_block); ;
  1483.     break;}
  1484. case 109:
  1485. #line 859 "./c-exp.y"
  1486. { yyval.tval = lookup_enum (copy_name (yyvsp[0].sval),
  1487.                         expression_context_block); ;
  1488.     break;}
  1489. case 110:
  1490. #line 862 "./c-exp.y"
  1491. { yyval.tval = lookup_unsigned_typename (TYPE_NAME(yyvsp[0].tsym.type)); ;
  1492.     break;}
  1493. case 111:
  1494. #line 864 "./c-exp.y"
  1495. { yyval.tval = builtin_type_unsigned_int; ;
  1496.     break;}
  1497. case 112:
  1498. #line 866 "./c-exp.y"
  1499. { yyval.tval = yyvsp[0].tsym.type; ;
  1500.     break;}
  1501. case 113:
  1502. #line 868 "./c-exp.y"
  1503. { yyval.tval = builtin_type_int; ;
  1504.     break;}
  1505. case 114:
  1506. #line 870 "./c-exp.y"
  1507. { yyval.tval = lookup_template_type(copy_name(yyvsp[-3].sval), yyvsp[-1].tval,
  1508.                             expression_context_block);
  1509.             ;
  1510.     break;}
  1511. case 116:
  1512. #line 877 "./c-exp.y"
  1513. {
  1514.           yyval.tsym.stoken.ptr = "int";
  1515.           yyval.tsym.stoken.length = 3;
  1516.           yyval.tsym.type = builtin_type_int;
  1517.         ;
  1518.     break;}
  1519. case 117:
  1520. #line 883 "./c-exp.y"
  1521. {
  1522.           yyval.tsym.stoken.ptr = "long";
  1523.           yyval.tsym.stoken.length = 4;
  1524.           yyval.tsym.type = builtin_type_long;
  1525.         ;
  1526.     break;}
  1527. case 118:
  1528. #line 889 "./c-exp.y"
  1529. {
  1530.           yyval.tsym.stoken.ptr = "short";
  1531.           yyval.tsym.stoken.length = 5;
  1532.           yyval.tsym.type = builtin_type_short;
  1533.         ;
  1534.     break;}
  1535. case 119:
  1536. #line 898 "./c-exp.y"
  1537. { yyval.tvec = (struct type **)xmalloc (sizeof (struct type *) * 2);
  1538.           yyval.tvec[0] = (struct type *)0;
  1539.           yyval.tvec[1] = yyvsp[0].tval;
  1540.         ;
  1541.     break;}
  1542. case 120:
  1543. #line 903 "./c-exp.y"
  1544. { int len = sizeof (struct type *) * ++(yyvsp[-2].ivec[0]);
  1545.           yyval.tvec = (struct type **)xrealloc ((char *) yyvsp[-2].tvec, len);
  1546.           yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval;
  1547.         ;
  1548.     break;}
  1549. case 121:
  1550. #line 909 "./c-exp.y"
  1551. { yyval.sval = yyvsp[0].ssym.stoken; ;
  1552.     break;}
  1553. case 122:
  1554. #line 910 "./c-exp.y"
  1555. { yyval.sval = yyvsp[0].ssym.stoken; ;
  1556.     break;}
  1557. case 123:
  1558. #line 911 "./c-exp.y"
  1559. { yyval.sval = yyvsp[0].tsym.stoken; ;
  1560.     break;}
  1561. case 124:
  1562. #line 912 "./c-exp.y"
  1563. { yyval.sval = yyvsp[0].ssym.stoken; ;
  1564.     break;}
  1565. case 125:
  1566. #line 913 "./c-exp.y"
  1567. { yyval.sval = yyvsp[0].ssym.stoken; ;
  1568.     break;}
  1569. }
  1570.    /* the action file gets copied in in place of this dollarsign */
  1571. #line 327 "bison.simple"
  1572.  
  1573.   yyvsp -= yylen;
  1574.   yyssp -= yylen;
  1575. #ifdef YYLSP_NEEDED
  1576.   yylsp -= yylen;
  1577. #endif
  1578.  
  1579. #if YYDEBUG != 0
  1580.   if (yydebug)
  1581.     {
  1582.       short *ssp1 = yyss - 1;
  1583.       fprintf (stderr, "state stack now");
  1584.       while (ssp1 != yyssp)
  1585.     fprintf (stderr, " %d", *++ssp1);
  1586.       fprintf (stderr, "\n");
  1587.     }
  1588. #endif
  1589.  
  1590.   *++yyvsp = yyval;
  1591.  
  1592. #ifdef YYLSP_NEEDED
  1593.   yylsp++;
  1594.   if (yylen == 0)
  1595.     {
  1596.       yylsp->first_line = yylloc.first_line;
  1597.       yylsp->first_column = yylloc.first_column;
  1598.       yylsp->last_line = (yylsp-1)->last_line;
  1599.       yylsp->last_column = (yylsp-1)->last_column;
  1600.       yylsp->text = 0;
  1601.     }
  1602.   else
  1603.     {
  1604.       yylsp->last_line = (yylsp+yylen-1)->last_line;
  1605.       yylsp->last_column = (yylsp+yylen-1)->last_column;
  1606.     }
  1607. #endif
  1608.  
  1609.   /* Now "shift" the result of the reduction.
  1610.      Determine what state that goes to,
  1611.      based on the state we popped back to
  1612.      and the rule number reduced by.  */
  1613.  
  1614.   yyn = yyr1[yyn];
  1615.  
  1616.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  1617.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1618.     yystate = yytable[yystate];
  1619.   else
  1620.     yystate = yydefgoto[yyn - YYNTBASE];
  1621.  
  1622.   goto yynewstate;
  1623.  
  1624. yyerrlab:   /* here on detecting error */
  1625.  
  1626.   if (! yyerrstatus)
  1627.     /* If not already recovering from an error, report this error.  */
  1628.     {
  1629.       ++yynerrs;
  1630.       yyerror("parse error");
  1631.     }
  1632.  
  1633.   if (yyerrstatus == 3)
  1634.     {
  1635.       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  1636.  
  1637.       /* return failure if at end of input */
  1638.       if (yychar == YYEOF)
  1639.     YYABORT;
  1640.  
  1641. #if YYDEBUG != 0
  1642.       if (yydebug)
  1643.     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
  1644. #endif
  1645.  
  1646.       yychar = YYEMPTY;
  1647.     }
  1648.  
  1649.   /* Else will try to reuse lookahead token
  1650.      after shifting the error token.  */
  1651.  
  1652.   yyerrstatus = 3;        /* Each real token shifted decrements this */
  1653.  
  1654.   goto yyerrhandle;
  1655.  
  1656. yyerrdefault:  /* current state does not do anything special for the error token. */
  1657.  
  1658. #if 0
  1659.   /* This is wrong; only states that explicitly want error tokens
  1660.      should shift them.  */
  1661.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  1662.   if (yyn) goto yydefault;
  1663. #endif
  1664.  
  1665. yyerrpop:   /* pop the current state because it cannot handle the error token */
  1666.  
  1667.   if (yyssp == yyss) YYABORT;
  1668.   yyvsp--;
  1669.   yystate = *--yyssp;
  1670. #ifdef YYLSP_NEEDED
  1671.   yylsp--;
  1672. #endif
  1673.  
  1674. #if YYDEBUG != 0
  1675.   if (yydebug)
  1676.     {
  1677.       short *ssp1 = yyss - 1;
  1678.       fprintf (stderr, "Error: state stack now");
  1679.       while (ssp1 != yyssp)
  1680.     fprintf (stderr, " %d", *++ssp1);
  1681.       fprintf (stderr, "\n");
  1682.     }
  1683. #endif
  1684.  
  1685. yyerrhandle:
  1686.  
  1687.   yyn = yypact[yystate];
  1688.   if (yyn == YYFLAG)
  1689.     goto yyerrdefault;
  1690.  
  1691.   yyn += YYTERROR;
  1692.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  1693.     goto yyerrdefault;
  1694.  
  1695.   yyn = yytable[yyn];
  1696.   if (yyn < 0)
  1697.     {
  1698.       if (yyn == YYFLAG)
  1699.     goto yyerrpop;
  1700.       yyn = -yyn;
  1701.       goto yyreduce;
  1702.     }
  1703.   else if (yyn == 0)
  1704.     goto yyerrpop;
  1705.  
  1706.   if (yyn == YYFINAL)
  1707.     YYACCEPT;
  1708.  
  1709. #if YYDEBUG != 0
  1710.   if (yydebug)
  1711.     fprintf(stderr, "Shifting error token, ");
  1712. #endif
  1713.  
  1714.   *++yyvsp = yylval;
  1715. #ifdef YYLSP_NEEDED
  1716.   *++yylsp = yylloc;
  1717. #endif
  1718.  
  1719.   yystate = yyn;
  1720.   goto yynewstate;
  1721. }
  1722. #line 928 "./c-exp.y"
  1723.  
  1724.  
  1725. /* Take care of parsing a number (anything that starts with a digit).
  1726.    Set yylval and return the token type; update lexptr.
  1727.    LEN is the number of characters in it.  */
  1728.  
  1729. /*** Needs some error checking for the float case ***/
  1730.  
  1731. static int
  1732. parse_number (p, len, parsed_float, putithere)
  1733.      register char *p;
  1734.      register int len;
  1735.      int parsed_float;
  1736.      YYSTYPE *putithere;
  1737. {
  1738.   register LONGEST n = 0;
  1739.   register LONGEST prevn = 0;
  1740.   register int i;
  1741.   register int c;
  1742.   register int base = input_radix;
  1743.   int unsigned_p = 0;
  1744.  
  1745.   if (parsed_float)
  1746.     {
  1747.       /* It's a float since it contains a point or an exponent.  */
  1748.       putithere->dval = atof (p);
  1749.       return FLOAT;
  1750.     }
  1751.  
  1752.   /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
  1753.   if (p[0] == '0')
  1754.     switch (p[1])
  1755.       {
  1756.       case 'x':
  1757.       case 'X':
  1758.     if (len >= 3)
  1759.       {
  1760.         p += 2;
  1761.         base = 16;
  1762.         len -= 2;
  1763.       }
  1764.     break;
  1765.  
  1766.       case 't':
  1767.       case 'T':
  1768.       case 'd':
  1769.       case 'D':
  1770.     if (len >= 3)
  1771.       {
  1772.         p += 2;
  1773.         base = 10;
  1774.         len -= 2;
  1775.       }
  1776.     break;
  1777.  
  1778.       default:
  1779.     base = 8;
  1780.     break;
  1781.       }
  1782.  
  1783.   while (len-- > 0)
  1784.     {
  1785.       c = *p++;
  1786.       if (c >= 'A' && c <= 'Z')
  1787.     c += 'a' - 'A';
  1788.       if (c != 'l' && c != 'u')
  1789.     n *= base;
  1790.       if (c >= '0' && c <= '9')
  1791.     n += i = c - '0';
  1792.       else
  1793.     {
  1794.       if (base > 10 && c >= 'a' && c <= 'f')
  1795.         n += i = c - 'a' + 10;
  1796.       else if (len == 0 && c == 'l')
  1797.         ;
  1798.       else if (len == 0 && c == 'u')
  1799.         unsigned_p = 1;
  1800.       else
  1801.         return ERROR;    /* Char not a digit */
  1802.     }
  1803.       if (i >= base)
  1804.     return ERROR;        /* Invalid digit in this base */
  1805.       /* Portably test for overflow (only works for nonzero values, so make
  1806.      a second check for zero).  */
  1807.       if((prevn >= n) && n != 0)
  1808.      unsigned_p=1;        /* Try something unsigned */
  1809.       /* If range checking enabled, portably test for unsigned overflow.  */
  1810.       if(RANGE_CHECK && n!=0)
  1811.       {    
  1812.      if((unsigned_p && (unsigned)prevn >= (unsigned)n))
  1813.         range_error("Overflow on numeric constant.");     
  1814.       }
  1815.       prevn=n;
  1816.     }
  1817.  
  1818.   if (unsigned_p)
  1819.     {
  1820.       putithere->ulval = n;
  1821.       return UINT;
  1822.     }
  1823.   else
  1824.     {
  1825.       putithere->lval = n;
  1826.       return INT;
  1827.     }
  1828. }
  1829.  
  1830. struct token
  1831. {
  1832.   char *operator;
  1833.   int token;
  1834.   enum exp_opcode opcode;
  1835. };
  1836.  
  1837. const static struct token tokentab3[] =
  1838.   {
  1839.     {">>=", ASSIGN_MODIFY, BINOP_RSH},
  1840.     {"<<=", ASSIGN_MODIFY, BINOP_LSH}
  1841.   };
  1842.  
  1843. const static struct token tokentab2[] =
  1844.   {
  1845.     {"+=", ASSIGN_MODIFY, BINOP_ADD},
  1846.     {"-=", ASSIGN_MODIFY, BINOP_SUB},
  1847.     {"*=", ASSIGN_MODIFY, BINOP_MUL},
  1848.     {"/=", ASSIGN_MODIFY, BINOP_DIV},
  1849.     {"%=", ASSIGN_MODIFY, BINOP_REM},
  1850.     {"|=", ASSIGN_MODIFY, BINOP_LOGIOR},
  1851.     {"&=", ASSIGN_MODIFY, BINOP_LOGAND},
  1852.     {"^=", ASSIGN_MODIFY, BINOP_LOGXOR},
  1853.     {"++", INCREMENT, BINOP_END},
  1854.     {"--", DECREMENT, BINOP_END},
  1855.     {"->", ARROW, BINOP_END},
  1856.     {"&&", ANDAND, BINOP_END},
  1857.     {"||", OROR, BINOP_END},
  1858.     {"::", COLONCOLON, BINOP_END},
  1859.     {"<<", LSH, BINOP_END},
  1860.     {">>", RSH, BINOP_END},
  1861.     {"==", EQUAL, BINOP_END},
  1862.     {"!=", NOTEQUAL, BINOP_END},
  1863.     {"<=", LEQ, BINOP_END},
  1864.     {">=", GEQ, BINOP_END}
  1865.   };
  1866.  
  1867. /* Read one token, getting characters through lexptr.  */
  1868.  
  1869. int
  1870. yylex ()
  1871. {
  1872.   register int c;
  1873.   register int namelen;
  1874.   register unsigned i;
  1875.   register char *tokstart;
  1876.  
  1877.  retry:
  1878.  
  1879.   tokstart = lexptr;
  1880.   /* See if it is a special token of length 3.  */
  1881.   for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
  1882.     if (!strncmp (tokstart, tokentab3[i].operator, 3))
  1883.       {
  1884.     lexptr += 3;
  1885.     yylval.opcode = tokentab3[i].opcode;
  1886.     return tokentab3[i].token;
  1887.       }
  1888.  
  1889.   /* See if it is a special token of length 2.  */
  1890.   for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
  1891.     if (!strncmp (tokstart, tokentab2[i].operator, 2))
  1892.       {
  1893.     lexptr += 2;
  1894.     yylval.opcode = tokentab2[i].opcode;
  1895.     return tokentab2[i].token;
  1896.       }
  1897.  
  1898.   switch (c = *tokstart)
  1899.     {
  1900.     case 0:
  1901.       return 0;
  1902.  
  1903.     case ' ':
  1904.     case '\t':
  1905.     case '\n':
  1906.       lexptr++;
  1907.       goto retry;
  1908.  
  1909.     case '\'':
  1910.       lexptr++;
  1911.       c = *lexptr++;
  1912.       if (c == '\\')
  1913.     c = parse_escape (&lexptr);
  1914.       yylval.lval = c;
  1915.       c = *lexptr++;
  1916.       if (c != '\'')
  1917.     error ("Invalid character constant.");
  1918.       return CHAR;
  1919.  
  1920.     case '(':
  1921.       paren_depth++;
  1922.       lexptr++;
  1923.       return c;
  1924.  
  1925.     case ')':
  1926.       if (paren_depth == 0)
  1927.     return 0;
  1928.       paren_depth--;
  1929.       lexptr++;
  1930.       return c;
  1931.  
  1932.     case ',':
  1933.       if (comma_terminates && paren_depth == 0)
  1934.     return 0;
  1935.       lexptr++;
  1936.       return c;
  1937.  
  1938.     case '.':
  1939.       /* Might be a floating point number.  */
  1940.       if (lexptr[1] < '0' || lexptr[1] > '9')
  1941.     goto symbol;        /* Nope, must be a symbol. */
  1942.       /* FALL THRU into number case.  */
  1943.  
  1944.     case '0':
  1945.     case '1':
  1946.     case '2':
  1947.     case '3':
  1948.     case '4':
  1949.     case '5':
  1950.     case '6':
  1951.     case '7':
  1952.     case '8':
  1953.     case '9':
  1954.       {
  1955.     /* It's a number.  */
  1956.     int got_dot = 0, got_e = 0, toktype;
  1957.     register char *p = tokstart;
  1958.     int hex = input_radix > 10;
  1959.  
  1960.     if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
  1961.       {
  1962.         p += 2;
  1963.         hex = 1;
  1964.       }
  1965.     else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
  1966.       {
  1967.         p += 2;
  1968.         hex = 0;
  1969.       }
  1970.  
  1971.     for (;; ++p)
  1972.       {
  1973.         if (!hex && !got_e && (*p == 'e' || *p == 'E'))
  1974.           got_dot = got_e = 1;
  1975.         else if (!hex && !got_dot && *p == '.')
  1976.           got_dot = 1;
  1977.         else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
  1978.              && (*p == '-' || *p == '+'))
  1979.           /* This is the sign of the exponent, not the end of the
  1980.          number.  */
  1981.           continue;
  1982.         /* We will take any letters or digits.  parse_number will
  1983.            complain if past the radix, or if L or U are not final.  */
  1984.         else if ((*p < '0' || *p > '9')
  1985.              && ((*p < 'a' || *p > 'z')
  1986.                   && (*p < 'A' || *p > 'Z')))
  1987.           break;
  1988.       }
  1989.     toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
  1990.         if (toktype == ERROR)
  1991.       {
  1992.         char *err_copy = (char *) alloca (p - tokstart + 1);
  1993.  
  1994.         bcopy (tokstart, err_copy, p - tokstart);
  1995.         err_copy[p - tokstart] = 0;
  1996.         error ("Invalid number \"%s\".", err_copy);
  1997.       }
  1998.     lexptr = p;
  1999.     return toktype;
  2000.       }
  2001.  
  2002.     case '+':
  2003.     case '-':
  2004.     case '*':
  2005.     case '/':
  2006.     case '%':
  2007.     case '|':
  2008.     case '&':
  2009.     case '^':
  2010.     case '~':
  2011.     case '!':
  2012.     case '@':
  2013.     case '<':
  2014.     case '>':
  2015.     case '[':
  2016.     case ']':
  2017.     case '?':
  2018.     case ':':
  2019.     case '=':
  2020.     case '{':
  2021.     case '}':
  2022.     symbol:
  2023.       lexptr++;
  2024.       return c;
  2025.  
  2026.     case '"':
  2027.       for (namelen = 1; (c = tokstart[namelen]) != '"'; namelen++)
  2028.     if (c == '\\')
  2029.       {
  2030.         c = tokstart[++namelen];
  2031.         if (c >= '0' && c <= '9')
  2032.           {
  2033.         c = tokstart[++namelen];
  2034.         if (c >= '0' && c <= '9')
  2035.           c = tokstart[++namelen];
  2036.           }
  2037.       }
  2038.       yylval.sval.ptr = tokstart + 1;
  2039.       yylval.sval.length = namelen - 1;
  2040.       lexptr += namelen + 1;
  2041.       return STRING;
  2042.     }
  2043.  
  2044.   if (!(c == '_' || c == '$'
  2045.     || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
  2046.     /* We must have come across a bad character (e.g. ';').  */
  2047.     error ("Invalid character '%c' in expression.", c);
  2048.  
  2049.   /* It's a name.  See how long it is.  */
  2050.   namelen = 0;
  2051.   for (c = tokstart[namelen];
  2052.        (c == '_' || c == '$' || (c >= '0' && c <= '9')
  2053.     || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
  2054.        c = tokstart[++namelen])
  2055.     ;
  2056.  
  2057.   /* The token "if" terminates the expression and is NOT 
  2058.      removed from the input stream.  */
  2059.   if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
  2060.     {
  2061.       return 0;
  2062.     }
  2063.  
  2064.   lexptr += namelen;
  2065.  
  2066.   /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1)
  2067.      and $$digits (equivalent to $<-digits> if you could type that).
  2068.      Make token type LAST, and put the number (the digits) in yylval.  */
  2069.  
  2070.   if (*tokstart == '$')
  2071.     {
  2072.       register int negate = 0;
  2073.       c = 1;
  2074.       /* Double dollar means negate the number and add -1 as well.
  2075.      Thus $$ alone means -1.  */
  2076.       if (namelen >= 2 && tokstart[1] == '$')
  2077.     {
  2078.       negate = 1;
  2079.       c = 2;
  2080.     }
  2081.       if (c == namelen)
  2082.     {
  2083.       /* Just dollars (one or two) */
  2084.       yylval.lval = - negate;
  2085.       return LAST;
  2086.     }
  2087.       /* Is the rest of the token digits?  */
  2088.       for (; c < namelen; c++)
  2089.     if (!(tokstart[c] >= '0' && tokstart[c] <= '9'))
  2090.       break;
  2091.       if (c == namelen)
  2092.     {
  2093.       yylval.lval = atoi (tokstart + 1 + negate);
  2094.       if (negate)
  2095.         yylval.lval = - yylval.lval;
  2096.       return LAST;
  2097.     }
  2098.     }
  2099.  
  2100.   /* Handle tokens that refer to machine registers:
  2101.      $ followed by a register name.  */
  2102.  
  2103.   if (*tokstart == '$') {
  2104.     for (c = 0; c < NUM_REGS; c++)
  2105.       if (namelen - 1 == strlen (reg_names[c])
  2106.       && !strncmp (tokstart + 1, reg_names[c], namelen - 1))
  2107.     {
  2108.       yylval.lval = c;
  2109.       return REGNAME;
  2110.     }
  2111.     for (c = 0; c < num_std_regs; c++)
  2112.      if (namelen - 1 == strlen (std_regs[c].name)
  2113.      && !strncmp (tokstart + 1, std_regs[c].name, namelen - 1))
  2114.        {
  2115.      yylval.lval = std_regs[c].regnum;
  2116.      return REGNAME;
  2117.        }
  2118.   }
  2119.   /* Catch specific keywords.  Should be done with a data structure.  */
  2120.   switch (namelen)
  2121.     {
  2122.     case 8:
  2123.       if (!strncmp (tokstart, "unsigned", 8))
  2124.     return UNSIGNED;
  2125.       if (current_language->la_language == language_cplus
  2126.       && !strncmp (tokstart, "template", 8))
  2127.     return TEMPLATE;
  2128.       break;
  2129.     case 6:
  2130.       if (!strncmp (tokstart, "struct", 6))
  2131.     return STRUCT;
  2132.       if (!strncmp (tokstart, "signed", 6))
  2133.     return SIGNED_KEYWORD;
  2134.       if (!strncmp (tokstart, "sizeof", 6))      
  2135.     return SIZEOF;
  2136.       break;
  2137.     case 5:
  2138.       if (!strncmp (tokstart, "union", 5))
  2139.     return UNION;
  2140.       if (!strncmp (tokstart, "short", 5))
  2141.     return SHORT;
  2142.       break;
  2143.     case 4:
  2144.       if (!strncmp (tokstart, "enum", 4))
  2145.     return ENUM;
  2146.       if (!strncmp (tokstart, "long", 4))
  2147.     return LONG;
  2148.       if (current_language->la_language == language_cplus
  2149.       && !strncmp (tokstart, "this", 4))
  2150.     {
  2151.       static const char this_name[] =
  2152.                  { CPLUS_MARKER, 't', 'h', 'i', 's', '\0' };
  2153.  
  2154.       if (lookup_symbol (this_name, expression_context_block,
  2155.                  VAR_NAMESPACE, 0, NULL))
  2156.         return THIS;
  2157.     }
  2158.       break;
  2159.     case 3:
  2160.       if (!strncmp (tokstart, "int", 3))
  2161.     return INT_KEYWORD;
  2162.       break;
  2163.     default:
  2164.       break;
  2165.     }
  2166.  
  2167.   yylval.sval.ptr = tokstart;
  2168.   yylval.sval.length = namelen;
  2169.  
  2170.   /* Any other names starting in $ are debugger internal variables.  */
  2171.  
  2172.   if (*tokstart == '$')
  2173.     {
  2174.       yylval.ivar =  lookup_internalvar (copy_name (yylval.sval) + 1);
  2175.       return VARIABLE;
  2176.     }
  2177.  
  2178.   /* Use token-type BLOCKNAME for symbols that happen to be defined as
  2179.      functions or symtabs.  If this is not so, then ...
  2180.      Use token-type TYPENAME for symbols that happen to be defined
  2181.      currently as names of types; NAME for other symbols.
  2182.      The caller is not constrained to care about the distinction.  */
  2183.   {
  2184.     char *tmp = copy_name (yylval.sval);
  2185.     struct symbol *sym;
  2186.     int is_a_field_of_this = 0;
  2187.     int hextype;
  2188.  
  2189.     sym = lookup_symbol (tmp, expression_context_block,
  2190.              VAR_NAMESPACE,
  2191.              current_language->la_language == language_cplus
  2192.              ? &is_a_field_of_this : NULL,
  2193.              NULL);
  2194.     if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) ||
  2195.         lookup_partial_symtab (tmp))
  2196.       {
  2197.     yylval.ssym.sym = sym;
  2198.     yylval.ssym.is_a_field_of_this = is_a_field_of_this;
  2199.     return BLOCKNAME;
  2200.       }
  2201.     if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
  2202.         {
  2203.       yylval.tsym.type = SYMBOL_TYPE (sym);
  2204.       return TYPENAME;
  2205.         }
  2206.     if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
  2207.     return TYPENAME;
  2208.  
  2209.     /* Input names that aren't symbols but ARE valid hex numbers,
  2210.        when the input radix permits them, can be names or numbers
  2211.        depending on the parse.  Note we support radixes > 16 here.  */
  2212.     if (!sym && 
  2213.         ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
  2214.          (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
  2215.       {
  2216.      YYSTYPE newlval;    /* Its value is ignored.  */
  2217.     hextype = parse_number (tokstart, namelen, 0, &newlval);
  2218.     if (hextype == INT)
  2219.       {
  2220.         yylval.ssym.sym = sym;
  2221.         yylval.ssym.is_a_field_of_this = is_a_field_of_this;
  2222.         return NAME_OR_INT;
  2223.       }
  2224.     if (hextype == UINT)
  2225.       {
  2226.         yylval.ssym.sym = sym;
  2227.         yylval.ssym.is_a_field_of_this = is_a_field_of_this;
  2228.         return NAME_OR_UINT;
  2229.       }
  2230.       }
  2231.  
  2232.     /* Any other kind of symbol */
  2233.     yylval.ssym.sym = sym;
  2234.     yylval.ssym.is_a_field_of_this = is_a_field_of_this;
  2235.     return NAME;
  2236.   }
  2237. }
  2238.  
  2239. void
  2240. yyerror (msg)
  2241.      char *msg;
  2242. {
  2243.   error (msg ? msg : "Invalid syntax in expression.");
  2244. }
  2245.  
  2246. /* Table mapping opcodes into strings for printing operators
  2247.    and precedences of the operators.  */
  2248.  
  2249. const static struct op_print c_op_print_tab[] =
  2250.   {
  2251.     {",",  BINOP_COMMA, PREC_COMMA, 0},
  2252.     {"=",  BINOP_ASSIGN, PREC_ASSIGN, 1},
  2253.     {"||", BINOP_OR, PREC_OR, 0},
  2254.     {"&&", BINOP_AND, PREC_AND, 0},
  2255.     {"|",  BINOP_LOGIOR, PREC_LOGIOR, 0},
  2256.     {"&",  BINOP_LOGAND, PREC_LOGAND, 0},
  2257.     {"^",  BINOP_LOGXOR, PREC_LOGXOR, 0},
  2258.     {"==", BINOP_EQUAL, PREC_EQUAL, 0},
  2259.     {"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
  2260.     {"<=", BINOP_LEQ, PREC_ORDER, 0},
  2261.     {">=", BINOP_GEQ, PREC_ORDER, 0},
  2262.     {">",  BINOP_GTR, PREC_ORDER, 0},
  2263.     {"<",  BINOP_LESS, PREC_ORDER, 0},
  2264.     {">>", BINOP_RSH, PREC_SHIFT, 0},
  2265.     {"<<", BINOP_LSH, PREC_SHIFT, 0},
  2266.     {"+",  BINOP_ADD, PREC_ADD, 0},
  2267.     {"-",  BINOP_SUB, PREC_ADD, 0},
  2268.     {"*",  BINOP_MUL, PREC_MUL, 0},
  2269.     {"/",  BINOP_DIV, PREC_MUL, 0},
  2270.     {"%",  BINOP_REM, PREC_MUL, 0},
  2271.     {"@",  BINOP_REPEAT, PREC_REPEAT, 0},
  2272.     {"-",  UNOP_NEG, PREC_PREFIX, 0},
  2273.     {"!",  UNOP_ZEROP, PREC_PREFIX, 0},
  2274.     {"~",  UNOP_LOGNOT, PREC_PREFIX, 0},
  2275.     {"*",  UNOP_IND, PREC_PREFIX, 0},
  2276.     {"&",  UNOP_ADDR, PREC_PREFIX, 0},
  2277.     {"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0},
  2278.     {"++", UNOP_PREINCREMENT, PREC_PREFIX, 0},
  2279.     {"--", UNOP_PREDECREMENT, PREC_PREFIX, 0},
  2280.     /* C++  */
  2281.     {"::", BINOP_SCOPE, PREC_PREFIX, 0},
  2282. };
  2283.  
  2284. /* These variables point to the objects
  2285.    representing the predefined C data types.  */
  2286.  
  2287. struct type *builtin_type_void;
  2288. struct type *builtin_type_char;
  2289. struct type *builtin_type_short;
  2290. struct type *builtin_type_int;
  2291. struct type *builtin_type_long;
  2292. struct type *builtin_type_long_long;
  2293. struct type *builtin_type_signed_char;
  2294. struct type *builtin_type_unsigned_char;
  2295. struct type *builtin_type_unsigned_short;
  2296. struct type *builtin_type_unsigned_int;
  2297. struct type *builtin_type_unsigned_long;
  2298. struct type *builtin_type_unsigned_long_long;
  2299. struct type *builtin_type_float;
  2300. struct type *builtin_type_double;
  2301. struct type *builtin_type_long_double;
  2302. struct type *builtin_type_complex;
  2303. struct type *builtin_type_double_complex;
  2304.  
  2305. struct type ** const (c_builtin_types[]) = 
  2306. {
  2307.   &builtin_type_int,
  2308.   &builtin_type_long,
  2309.   &builtin_type_short,
  2310.   &builtin_type_char,
  2311.   &builtin_type_float,
  2312.   &builtin_type_double,
  2313.   &builtin_type_void,
  2314.   &builtin_type_long_long,
  2315.   &builtin_type_signed_char,
  2316.   &builtin_type_unsigned_char,
  2317.   &builtin_type_unsigned_short,
  2318.   &builtin_type_unsigned_int,
  2319.   &builtin_type_unsigned_long,
  2320.   &builtin_type_unsigned_long_long,
  2321.   &builtin_type_long_double,
  2322.   &builtin_type_complex,
  2323.   &builtin_type_double_complex,
  2324.   0
  2325. };
  2326.  
  2327. const struct language_defn c_language_defn = {
  2328.   "c",                /* Language name */
  2329.   language_c,
  2330.   c_builtin_types,
  2331.   range_check_off,
  2332.   type_check_off,
  2333.   c_parse,
  2334.   c_error,
  2335.   &BUILTIN_TYPE_LONGEST,     /* longest signed   integral type */
  2336.   &BUILTIN_TYPE_UNSIGNED_LONGEST,/* longest unsigned integral type */
  2337.   &builtin_type_double,        /* longest floating point type */ /*FIXME*/
  2338.   "0x%x", "0x%", "x",        /* Hex   format, prefix, suffix */
  2339.   "0%o",  "0%",  "o",        /* Octal format, prefix, suffix */
  2340.   c_op_print_tab,        /* expression operators for printing */
  2341.   LANG_MAGIC
  2342. };
  2343.  
  2344. const struct language_defn cplus_language_defn = {
  2345.   "c++",                /* Language name */
  2346.   language_cplus,
  2347.   c_builtin_types,
  2348.   range_check_off,
  2349.   type_check_off,
  2350.   c_parse,
  2351.   c_error,
  2352.   &BUILTIN_TYPE_LONGEST,     /* longest signed   integral type */
  2353.   &BUILTIN_TYPE_UNSIGNED_LONGEST,/* longest unsigned integral type */
  2354.   &builtin_type_double,        /* longest floating point type */ /*FIXME*/
  2355.   "0x%x", "0x%", "x",        /* Hex   format, prefix, suffix */
  2356.   "0%o",  "0%",  "o",        /* Octal format, prefix, suffix */
  2357.   c_op_print_tab,        /* expression operators for printing */
  2358.   LANG_MAGIC
  2359. };
  2360.  
  2361. void
  2362. _initialize_c_exp ()
  2363. {
  2364.   builtin_type_void =
  2365.     init_type (TYPE_CODE_VOID, 1,
  2366.            0,
  2367.            "void", (struct objfile *) NULL);
  2368.   builtin_type_char =
  2369.     init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
  2370.            0,
  2371.            "char", (struct objfile *) NULL);
  2372.   builtin_type_signed_char =
  2373.     init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
  2374.            TYPE_FLAG_SIGNED,
  2375.            "signed char", (struct objfile *) NULL);
  2376.   builtin_type_unsigned_char =
  2377.     init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
  2378.            TYPE_FLAG_UNSIGNED,
  2379.            "unsigned char", (struct objfile *) NULL);
  2380.   builtin_type_short =
  2381.     init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
  2382.            0,
  2383.            "short", (struct objfile *) NULL);
  2384.   builtin_type_unsigned_short =
  2385.     init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
  2386.            TYPE_FLAG_UNSIGNED,
  2387.            "unsigned short", (struct objfile *) NULL);
  2388.   builtin_type_int =
  2389.     init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
  2390.            0,
  2391.            "int", (struct objfile *) NULL);
  2392.   builtin_type_unsigned_int =
  2393.     init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
  2394.            TYPE_FLAG_UNSIGNED,
  2395.            "unsigned int", (struct objfile *) NULL);
  2396.   builtin_type_long =
  2397.     init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
  2398.            0,
  2399.            "long", (struct objfile *) NULL);
  2400.   builtin_type_unsigned_long =
  2401.     init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
  2402.            TYPE_FLAG_UNSIGNED,
  2403.            "unsigned long", (struct objfile *) NULL);
  2404.   builtin_type_long_long =
  2405.     init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
  2406.            0,
  2407.            "long long", (struct objfile *) NULL);
  2408.   builtin_type_unsigned_long_long = 
  2409.     init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
  2410.            TYPE_FLAG_UNSIGNED,
  2411.            "unsigned long long", (struct objfile *) NULL);
  2412.   builtin_type_float =
  2413.     init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
  2414.            0,
  2415.            "float", (struct objfile *) NULL);
  2416.   builtin_type_double =
  2417.     init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
  2418.            0,
  2419.            "double", (struct objfile *) NULL);
  2420.   builtin_type_long_double =
  2421.     init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
  2422.            0,
  2423.            "long double", (struct objfile *) NULL);
  2424.   builtin_type_complex =
  2425.     init_type (TYPE_CODE_FLT, TARGET_COMPLEX_BIT / TARGET_CHAR_BIT,
  2426.            0,
  2427.            "complex", (struct objfile *) NULL);
  2428.   builtin_type_double_complex =
  2429.     init_type (TYPE_CODE_FLT, TARGET_DOUBLE_COMPLEX_BIT / TARGET_CHAR_BIT,
  2430.            0,
  2431.            "double complex", (struct objfile *) NULL);
  2432.  
  2433.   add_language (&c_language_defn);
  2434.   add_language (&cplus_language_defn);
  2435. }
  2436.